Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi again,

 

I have managed to "ADD" a record and update the changes to the Access database, but I have not figured yet how can I "CHANGE" a record and save the changes to do database. At What is worng with this code?

 

tempDT.Rows[2].BeginEdit();

tempDT.Rows[2]["descri"] = "BLABLA";

tempDT.Rows[2].EndEdit();

tempDT.Rows[2].AcceptChanges();

 

oOleDbDA.Update(tempDT);

 

The code executes with no prob, though the database does not assume the changes. Or, maybe (most certain) the changes are not sent to the database at all!

  • Administrators
Posted
Hi again,

 

I have managed to "ADD" a record and update the changes to the Access database, but I have not figured yet how can I "CHANGE" a record and save the changes to do database. At What is worng with this code?

 

tempDT.Rows[2].BeginEdit();

tempDT.Rows[2]["descri"] = "BLABLA";

tempDT.Rows[2].EndEdit();

tempDT.Rows[2].AcceptChanges();

 

oOleDbDA.Update(tempDT);

 

The code executes with no prob, though the database does not assume the changes. Or, maybe (most certain) the changes are not sent to the database at all!

 

Calling accept changes flags all modified records in the dataset has being saved.

Move the call to Acceptchanges to after the .Update and things should work fine.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

"An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll

 

Additional information: Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information."

Posted (edited)

Hi, tks for replay, am not sure if I understand what did u said in ur last post. But, I do know that am creating an DataAdapter all right and am letting VStudio to generate de code for me (if I understood correctly what u have said).

 

Could u point me to an "Update" example? Because I believe that a small example worths more that one thousand words.

 

Anyway, am still trying to get one (example) in Web...

Edited by EFileTahi-A
Posted

Ah, no, I did not had an a primary key defined, and, after I define one, the "AcceptChanges" after the "DataAdapter.Update" MADE IT WORK!

 

Ok, for the help and patience with me :)

 

- THREAD RESOLVED -

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...