views:

14

answers:

1

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

A: 

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

Nikhil