检测数据集/数据表中的行何时已更改 [英] Detecting when a row has changed in a dataset/datatable

查看:51
本文介绍了检测数据集/数据表中的行何时已更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图在我的C#winforms应用程序中添加一些额外的日志记录。我有一些数据绑定表,其中所有数据库内容都由绑定源和某些类型化的数据集/适配器管理。

I'm trying to add some extra logging to my C# winforms application. I have a few data bound forms that all the database stuff is managed by a binding source and some typed datasets/adapters.

使用此设置,很难分辨更改某些内容时,我必须管理每个字段并保持其先前的值。有什么方法可以使我了解数据集并何时进行更改?我知道datarow具有RowState枚举,那是一个不错的起点吗?我查看了绑定源的DataMemberChanged事件,但从未触发过该事件。

With this setup, it's kind of difficult to tell when something is changed, I'd have to manage each field and keep it's previous value. Is there a way I can hook into the dataset and tell when something is changed? I know datarow's have a RowState enumeration, would that be a good place to start? I looked into the binding source's DataMemberChanged event but it never fired so...

推荐答案

您可以使用 RowChanged 事件,即行更改事件或任何数据表引发的其他事件

You can use the RowChanged event, the RowChanging event, or any of the other events raised by a DataTable.

这篇关于检测数据集/数据表中的行何时已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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