Reputation: 128387
The DataTable
class has RowChanging
as well as RowChanged
events, which is convenient (for those of us foolish enough to be using the DataTable
class in the first place). Event handlers for these events take a parameter of type DataRowChangeEventArgs
, whose properties comprise a DataRowAction
(Add, Change, Delete, etc.) and the DataRow
being changed or having just changed.
Is there any way to actually know which fields of the DataRow
are being changed (in the RowChanging
event) or have just changed (in the RowChanged
event)? If not, is it possible to get this information in some other way?
Upvotes: 2
Views: 766
Reputation: 633
If you want to know which fields are changed, I think you're better of using ColumnChanged http://msdn.microsoft.com/en-us/library/system.data.datatable.columnchanged.aspx or ColumnChanging http://msdn.microsoft.com/en-us/library/system.data.datatable.columnchanging.aspx.
In both cases there is an example to get the old and new values.
Upvotes: 4
Reputation: 18296
for the RowChanging
event, if the action is Change
you can use the DataRow
indexer that takes the DataRowVersion
parameter in order to get the old and the new value.
similar approach can be taken for the RowChanged
event.
Upvotes: 1