Kid_Icarus Posted July 6, 2006 Posted July 6, 2006 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 Quote
Administrators PlausiblyDamp Posted July 6, 2006 Administrators Posted July 6, 2006 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Kid_Icarus Posted July 6, 2006 Author Posted July 6, 2006 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. Quote
Administrators PlausiblyDamp Posted July 6, 2006 Administrators Posted July 6, 2006 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.