I'm confused as to the effect of using AcceptChanges within a dataset. It appears from my tests that this forces the database changes to be comitted, disregarding any constraints on the database.
Can anyone confirm if this is the case, or if not, how this differs from using the Update function on the dataset?
AcceptChanges doesn't affect your database, it only affects the DataSet (your in-memory copy of the data).
Using AcceptChanges will cause all Datarows of all tables in the data set to have its Rowstate reset to RowState.Unchanged.
You would normally use AcceptChanges together with the DataTable.GetChanges method. Or with the DbDataAdapter.Update method. You would use either of them to get the changes or to persist the changes to the database, and you would then use AcceptChanges to tell the DataSet that the changes have been stored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With