How to run UpdateDataset with AcceptChangesDuringUpdate = False?

Topics: Data Access Application Block
Sep 7, 2015 at 6:45 PM
Edited Sep 7, 2015 at 6:45 PM
I'm using Enterprise Libratry 5.0, Visual Studio 2010 and .NET Framework 4.0. I'm updating multiple tables in a data set by creating a connection, beginning a transaction and calling Database.UpdateDataSet for each table. If an error occurs I rollback the transaction and leave the database unchanged. Regarding the data set, there are two situations: I either want to keep the changes, so the user can try to save them again, or I want to roll them back. My problem is that the UpdateDataSet function automatically accepts changes in the data set. In case of a transaction rollback, that can cause the data set to become inconsistent with the database: changes that have been accepted in the data set are not processed in the database. The DataAdapter has a property AcceptChangesDuringUpdate to avoid that. How should I avoid that changes are accepted when using the Enterprise Library?