Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Im trying to update my table in the database, using this code;

 

        ÄrendeBindingSource.EndEdit()
       ITMDBDataSet.Ärende.AcceptChanges()
       ÄrendeTableAdapter.Update(ITMDBDataSet.Ärende)

 

What am I doing wrong?

 

And also, what is the command to delete a record?

 

Simple questions I know...

 

 

Kind regards,

Kid Icarus

Posted
Don't call .AcceptChanges until after you have done the .Update().

 

AcceptChanges resets the RowState of all rows in the DataSet / DataTable, so when the .Update is called it doesn't see any rows has having changes.

 

 

I get this message when I dont have acceptchanges:

 

Update requires a valid UpdateCommand when passed DataRow collection with modified rows.

 

??

 

Kid Icarus.

  • Administrators
Posted

Have you assigned a valid command to the DataAdapter's .UpdateCommand property? If not then the Adapter has no way of knowing how to send the updates back to the data source.

 

Either write a valid update command (prefered way) or try to see if the CommandBuilder class can do it for you.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

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...