我有一个数据表,我想找出原始列值的所有修改过的数据行。
I have a DataTable and i want to figure out the Original column value for all the modified data rows.
我使用下面的方法来获取原单列值的DataRow被修改之前
I am using following approach to get the Orginal column value before the DataRow was modified
DataRow[] dataRowArray = dataTableInstance.Select(null,null,DataViewRowState.OriginalRows);
DataRow originalDataRow = dataRowArray[rowIndex][columnIndex, DataRowVersion.Original]
请指出我究竟做错了什么?以上code不给我原始列,而是给了我最新的修改列的值。
Please point out what am I doing wrong here ? Above code does not give me the Original column , instead it gives me the latest modified column value.
感谢。 尼基尔
Thanks. Nikhil
当你调用原始值都将丢失的AcceptChanges
(当你调用它通常被称为更新
在 DataAdapter的
或的TableAdapter
太)。一旦接受更改,您无法访问原始值,这可能是为什么你的code不起作用。
Original values are lost when you call AcceptChanges
(which is usually called when you call Update
on a DataAdapter
or TableAdapter
too). Once the changes are accepted, you can't access the original values, that's probably why your code doesn't work.