How can I get the previous version of data of a Row in a DataTable? The data has only changed but hasn’t been saved yet.
The .NET version I’m working on is 1.1
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The System.Data.DataTable and System.Data.DataRow classes in ADO.NET maintains different versions and states of the rows that allow you to rollback changes made.
In you scenario once you have made changes to the data table you can rollback to the previous version by using DataRow.RejectChanges() method.
You can get a copy of the data table with the changes made using DataTable.GetChanges() method.
You can detect if a row has changed using the DataRow.RowState enumeration.
A detailed description of the datatable class and its method and attributes can be found in this article