By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,333 Members | 1,391 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,333 IT Pros & Developers. It's quick & easy.

error in update command using dataadapter

P: n/a

m using this code :...........................

================================================== =====================

OleDbConnection con =new OleDbConnection
(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and
Settings\ic411242\My Documents\db2.mdb");
con.Open ();

OleDbDataAdapter adp =new OleDbDataAdapter();
adp.SelectCommand = new OleDbCommand ( "select * from t1",con);

OleDbCommandBuilder cbd =new OleDbCommandBuilder (adp);
DataSet ds =new DataSet ();
adp.Fill (ds,"t1");

ds.Tables["t1"].Rows[0]["name"]="crystal";
adp.Update(ds,"t1");

con.Close ();
================================================== =====================

PROBLEM :: RUNTIME ERROR --- Dynamic SQL generation for the
UpdateCommand is not supported against a SelectCommand that does not
return any key column information.

t1 = TABLE IN MY DOCUMENTS

Feb 2 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi nannu,

I'm guessing your table is lacking a primary key/identity column. Without
such a column you can't use CommandBuilder to generate your update
commands. However, you can still create the update command manually.

--
Happy Coding!
Morten Wennevik [C# MVP]
Feb 2 '07 #2

P: n/a
Hi Morten ,
thanks very much for ur help it worked on ... keep
assisting me in future also .
--- bye
nannu
Feb 5 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.