c# - Error while updating in database using dataset -


while running below code getting error

dynamic sql generation updatecommand not supported against selectcommand not return key column information.

tried doing many things nothing working. below code

 string queryup = "select node_a_objectid,node_z_objectid nddilinks";             string myconnectionstring = @"provider=microsoft.jet.oledb.4.0; data source=d:\tiptondb.mdb";             dataset dtup = new dataset();             using (oledbconnection myconnection = new oledbconnection())             {                 myconnection.connectionstring = myconnectionstring;                 oledbcommand cmd = new oledbcommand();                 cmd.connection = myconnection;                 myconnection.open();                 oledbdataadapter adp = new oledbdataadapter(queryup, myconnection);                 adp.fillschema(dtup, schematype.source, "nddilinks");                 adp.fill(dtup, "nddilinks");                  dtup.tables[0].rows[1][0] = 2350;                 adp.acceptchangesduringupdate = true;                  oledbcommandbuilder objcommandbuilder = new oledbcommandbuilder(adp);                 cmd.parameters.add("@node_a_objectid", oledbtype.integer, sizeof(int), "node_a_objectid");                 int a1 = adp.update(dtup, "nddilinks");                 dtup.acceptchanges(); 

i not selecting primary key 2 values node_a_objectid,node_z_objectid.do need select primary key ?

based on comment on post. must select primary key update work dataset, or can specify own update or insert query. may see this discussion on msdn


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -