数据库更改时通知 [英] Notify when database is changed

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

问题描述

大家好,



我需要找到一种方法来做类似SqlDependency在winform应用程序中做的事情。

我意味着我想在指定的表被更改时得到通知,所以我可以用更新的数据刷新我的表示层。



由于它的长列表我不能使用sqldependency限制。



请帮帮我...

Hi every body,

I need to find a way to do something like what SqlDependency doing in my winform application.
I mean that i want to notified when the specified table is changed, so i can refresh my presentation layer with updated data.

I can not use sqldependency because of it's long list of limitations.

please help me...

推荐答案

你可以用Timer来检查每一个频繁的时间......把你的桌子放在会话中并获得最新的...比较两者并完成你的Presenatation图层
You can use Timer to check for every frequent time...Place your table in session and get the latest...Compare the two and finalize your Presenatation layer


我们可以通过服务代理和快照隔离来完成。请查看以下链接以获取信息



http://stackoverflow.com/questions/5288434/how-to-monitor-sql-server-table-changes-by-using-c [ ^ ]

http://msdn.microsoft.com/en-us/library /cc305322.aspx [ ^ ]
we can do through service brokers and with snap shots isolation. Please check below links for information

http://stackoverflow.com/questions/5288434/how-to-monitor-sql-server-table-changes-by-using-c[^]
http://msdn.microsoft.com/en-us/library/cc305322.aspx[^]


SqlCommand cmd = xxx

cmd.Notification = null;

SqlDependency dependency = new SqlDependency(cmd);

dependency.OnChange + = OnChange;
SqlCommand cmd = xxx
cmd.Notification = null;
SqlDependency dependency = new SqlDependency(cmd);
dependency.OnChange += OnChange;


这篇关于数据库更改时通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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