DataTable RowChanged how to get the previous Row value?

I have a DataTable. When a change occurs in a row, I need to get this row and its previous value (DataRow). How can i get it?

+4
source share
1 answer

You must subscribe to ColumnChanged so you can see previous and current values.

Example:

 //code to wire up the handler custTable.ColumnChanged += new DataColumnChangeEventHandler(Column_Changed); //code for the event private static void Column_Changed(object sender, DataColumnChangeEventArgs e ) { Console.WriteLine("Column_Changed Event: name={0}; Column={1}; original name={2}", e.Row["name"], e.Column.ColumnName, e.Row["name", DataRowVersion.Original]); } 
+7
source

Source: https://habr.com/ru/post/1469319/


All Articles