Get Original-Value of an DataColumn?

  • Thread starter Thread starter Daniel Barisch
  • Start date Start date
D

Daniel Barisch

Is it possible to get the value of a dataColumn, that was stored, before
changes were made (after the last "AcceptChanges")? So that updates with a
Database can be made by hand and not with the standard-update-command (SQL)?

I think of code like

changes = myDataTable.GetChanges(DataRowState.Modified)
for each row in changes
for each col in row
newVal = row.item(col).Value
orgVal = row.item(col).OriginalValue
if not orgVal = newVal then
...
end if
next col
next row

Thanks, D.Barisch
 
In a word, No. Onec you call AcceptChanges, the original versions of rows
and columns are cleared out and are unobtainable. Grab your original version
stuff prior to a call to AcceptChanges on the DataSet.

Hope that helps,

Pete


--
Peter Wright
Author of ADO.NET Novice To Pro, from Apress Inc.


_____________________________
 
In a word, No. Onec you call AcceptChanges, the original versions of rows
and columns are cleared out and are unobtainable. Grab your original version
stuff prior to a call to AcceptChanges on the DataSet.

I guess my question was a little bit confusing, what I meant was

1. fill new DataSet with values out of a DB
2. DataSet.AcceptChanges
3. Active Working with the DataSet
4. Compare the values from directly after Step 2 to the values directly
before step 4

In beetween I got a solution:

newVals = DataSet.GetChanges(...)
orgVals = DataSet.GetChanges(...)
orgVals.RejectChanges

==> now it is possible to compare the new and old Values

Or does this not work?

Thanks, D.Barisch
 
Back
Top