如何使SQL在SQL Client上发生事件 [英] How to make SQL rise an event at SQL Client

查看:82
本文介绍了如何使SQL在SQL Client上发生事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在C#中创建ConsoleApp,它将在客户端的本地磁盘上写入与其他人添加到SQL Server的数据相对应的内容。现在我不知道有没有一种方法可以使SQL在客户端引发事件。

我的想法是通过打开连接并选择数据来定期检查新数据。

开始之前编码我想探索从SQL Server到SQL Client的其他通信方式。

另一个想法是在SQL端进行CLR,这将由插入数据的表上的触发器触发。

I need to create ConsoleApp in C# which is going to write something on local disk of client corresponding of data added to SQL Server by others. Now I do not know is there a way to SQL rise an event at client.
My idea is to periodicity check for new data by opening connection and selecting data.
Before I start coding Ill like to explore others ways of communicate from SQL Server to SQL Client.
Another idea is to make CLR at SQL side which is going to be triggered by trigger on table where data is inserted.

推荐答案

也许查询通知。根据我的经验,易于使用且非常可靠。

Perhaps Query Notifications is what you're looking for. Easy to use and quite reliable, in my experience.

当然,您仍然必须进行一次查询,但是您注册了一些事件,这些事件可以让您知道何时查询的结果集已更改,因此您可以随后获取新数据。

You still have to make your query once, of course, but you sign up for events which let you know when the result set of the query have changed, so that you can then grab the new data.

这篇关于如何使SQL在SQL Client上发生事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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