Datatable.acceptchanges() commits data to the table Datatable.acceptchanges() commits data to the table database database

Datatable.acceptchanges() commits data to the table


The purpose of AcceptChanges() is to let the DataTable know that its data has been saved to the database. All DataRows in the DataTable have their row.RowState set to DataRowState.Unchanged.

It does not save the data to the database. That is done separately.


Here's the documentation:

When AcceptChanges is called, any DataRow object still in edit mode successfully ends its edits. The DataRowState also changes: all Added and Modified rows become Unchanged, and Deleted rows are removed.

The AcceptChanges method is generally called on a DataTable after you attempt to update the DataSet using the DbDataAdapter.Update method.

So your actual database is unaffected.


Will only affect the datatable. Not any DB table.