Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting when a row has changed in a dataset/datatable

I'm trying to add some extra logging to my C# winforms application. I have a few data bound forms that all the database stuff is managed by a binding source and some typed datasets/adapters.

With this setup, it's kind of difficult to tell when something is changed, I'd have to manage each field and keep it's previous value. Is there a way I can hook into the dataset and tell when something is changed? I know datarow's have a RowState enumeration, would that be a good place to start? I looked into the binding source's DataMemberChanged event but it never fired so...

like image 465
Malfist Avatar asked Feb 06 '26 04:02

Malfist


1 Answers

To get the original value of an updated Data value you can do this:

<DataTableRow>[<DataColumn>, DataRowVersion.Original]
like image 101
CSharpAtl Avatar answered Feb 09 '26 07:02

CSharpAtl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!