要知道使用SQLDependency时更改了哪一行 [英] To know which row changed when using SQLDependency

查看:86
本文介绍了要知道使用SQLDependency时更改了哪一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在使用SQLDependency来获取表通知.在我的OnChangeEventHandler内部,我想特别知道已修改了哪一行.我怎样才能做到这一点?我知道在SqlNotificationEventArgs的表上,我可以知道这是插入,更新还是删除操作.但是,我怎么知道哪个特定的行已更改?

Hello, I''m using SQLDependency to get table notifications. Inside my OnChangeEventHandler I want to specifically know which row has been modified. How can I do that? I understand that on table from SqlNotificationEventArgs, I can know if this is insert or update or delete operations. But how can I know which specific row has been changed?

推荐答案

如果我正确地理解了这个问题,那就意味着你想知道表的哪一行受到了影响.

您的表中可以有一个标识列,该列可以为您提供添加,更新或删除的信息.如果您想跟踪,可以将记录添加到日志文件中以供参考
If i have understood the question correctly that means you want to know which row of table has been affected.

You can have an identity column in your table which will can provide you the information of add,update, or delete. and if you want to keep a track u can add record to log file for reference


这篇关于要知道使用SQLDependency时更改了哪一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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