Article ID: 310351 - Last Review: June 29, 2004 - Revision: 2.3 How To Roll Back Updates After an Error When You Use DataAdapter and DataSet in ADO.NET and Visual Basic .NETThis article was previously published under Q310351 On This PageSUMMARY
This article describes how to roll back updates after an error when you use a DataAdapter and a DataSet object. If your client application uses an ADO.NET DataSet object to store changes that are made to data or to add new records, you can use a Transaction object, a DataSet object, and a DataAdapter object to roll back any changes if an error occurs. If you use a CommandBuilder object to generate INSERT, UPDATE, and DELETE commands, you must set the Transaction property of the SELECT command of the DataAdapter. If you use a wizard to generate a typed DataSet and its Command objects to populate the InsertCommand, the UpdateCommand, and the DeleteCommand properties of the DataAdapter, you must set the Transaction property for each InsertCommand, UpdateCommand, and DeleteCommand but not the SelectCommand of the DataSet. NOTE: This article uses the CommandBuilder. Steps to Build the Sample
REFERENCES
For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
SqlTransaction Class http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx (http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx) OleDbTransaction Class http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbtransaction.aspx (http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbtransaction.aspx) How to Add a DataRow to a DataTable in a DataSet http://msdn.microsoft.com/en-us/library/system.data.datarow.aspx (http://msdn.microsoft.com/en-us/library/system.data.datarow.aspx) | Article Translations
|

Back to the top
