Link to home
Start Free TrialLog in
Avatar of brokeMyLegBiking
brokeMyLegBiking

asked on

find out if a field has changed in a datatable

How can I find out if a field has changed in a data table?

I am trying to create an audit record of any changes that are made to the data in a table which is bound to textbox controls on a form. Before I insert a new audit record, I need to figure out which values are different from the underlying data.

Avatar of Jojo1771
Jojo1771

Well, I would define 2 data sets. Load the two at the begining of the audit, then at the time to prefomr  the audit, I would take the dataset that was tied to your datagrd or what ever. And I would comapre them line by line like this.

dim i, j as integer
i=0
while i < then dataset1.tables(0).rows.count 'no compiler in front of me  so count may not be  exactly where i typed it
j=0
While j < dataset1.tables(0).colums.count ' no compiler so you may have to explorer to find this count
if dataset1.tables(0).rows(i).item(j) = dataset2.tables(0).rows(i).items(j) then
'no diffrences so do notin
else
'diffrence here so do audit
j=j+1
end while
i=i+1
end while

ASKER CERTIFIED SOLUTION
Avatar of MsFox
MsFox

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brokeMyLegBiking

ASKER

MsFox, that sounds right, let me try that.