|
-
May 26th, 2004, 03:13 AM
#1
Simple ADO.NET questions - Part II
1. What does the Update method of the data adapter actually do? Does it make the changes in the database, or something else?
2. What is .AcceptChanges()?
3. My reason for asking question #1 is this:
When updating in the simple DB application I'm making, I need only to set the command object, its parameters, and UPDATE the data adapter.
When deleting, though, I have to actually perform a .ExecuteNonQuery in addition to the .Update() method.
Why this difference?
-
May 26th, 2004, 07:32 AM
#2
Hyperactive Member
The update method applies all changes made to the local dataset when you call this. . . Provided that you have associated the appropriate commands with your data adapter.
It is necessary to set the SelectCommand, InsertCommand, UpdateCommand, and DeleteCommand with the appropriate command objects. Once you have done this, all changes will be submitted back to the database when you call the DataAdapter.Update method.
AcceptChanges applies only to the local dataset, this can be a dangerous method as it tells the DataAdapter to commit all changes to the (Local) data set only, not back to the data source. So if you were to call AcceptChanges and follow it up with Update, you would find that your changes would not be written back to the data source.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|