如何从DataRow中获得原始DataColumn的价值呢? [英] How to get original DataColumn value from DataRow?

查看:137
本文介绍了如何从DataRow中获得原始DataColumn的价值呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据表,我想找出原始列值的所有修改过的数据行。

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.

这篇关于如何从DataRow中获得原始DataColumn的价值呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆