如何获取数据集行的特定版本? [英] How can I get a specific version of a dataset row?

查看:179
本文介绍了如何获取数据集行的特定版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用数据集,每行都有一个名为hasVersion()的方法,这意味着我保留该行的原始和当前版本的副本。如何获得原始行值之一?

using a dataset,each row has a method called hasVersion() which implies to me it keeps a copy of the original and current versions of that row. How can I get one of the original row values?

我想象可以在该行调用拒绝更改,然后检查该值,但我宁愿不会丢失更改,只是读取值)

I'd imagine it's possible to call reject changes on that row and then check the value, but I'd rather not lose the changes, just read the value(s).

推荐答案

如果您正在查看特定行,您可以通过获取行的值的特定版本href =http://msdn.microsoft.com/en-us/library/system.data.datarowversion.aspx =nofollow noreferrer> DataRowVersion 枚举通过其中一个重载,例如

If you are looking at a particular row, you can get a particular version of the row's values through the DataRowVersion enumeration thru one of the overloads, e.g.

SomeDataRow[0, DataRowVersion.Original] //by index
SomeDataRow["ColumnName", DataRowVersion.Original] //by column name

与此同时,您可能需要使用 GetChanges()方法在datatable上。传递 DataRowState (在您的情况下,DataRowState .Modified),然后使用上述来获取任何已更改的行的原始值。

Along with that, you might want to use the GetChanges() method on the datatable. Pass in a DataRowState (in your case, DataRowState.Modified), then use the above to get the original value of any rows that have changed.

这篇关于如何获取数据集行的特定版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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