How to: Commit Changes in a Dataset
As you make changes to records in a dataset by updating, inserting, and deleting records, the dataset maintains original and current versions of the records. In addition, each row's TableAdapter or data adapter. Call AcceptChanges after submitting changes to a database.property keeps track of whether the records are in their original state or have been updated, inserted, or deleted. This information is useful when you need to find a particular version of a row. Typically, you would get a subset of all changed records to send to another process. For more information, see . After you have processed all the changed rows, you can commit the changes by calling the AcceptChanges method of the , , or . The AcceptChanges method is called automatically when calling the update methods of a
When you callon the DataSet, any DataRow objects still in edit mode successfully end their edits. The RowState property of each DataRow also changes; and rows become , and rows are removed.
If the DataSet containsobjects, invoking the AcceptChanges method also causes the to be enforced.
To commit changes in a dataset
Call the AcceptChanges method on either a DataSet, DataTable, or DataRow to commit the changes in those objects.
The following example shows how to call the AcceptChanges method to commit changes in the Customers table after updating a data source: