存储过程输出的Sqldependency [英] Sqldependency for stored procedure output

查看:78
本文介绍了存储过程输出的Sqldependency的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



在一个项目中,我在c#中设置了一个 SqlDependency 对象来从中检索数据数据库为 PostQueryNotification 。那工作正常。当我在该表中插入,更新或删除记录时,我创建的查询被触发为事件。



是否可以使用SQL MessageBroker和C# SQLDependency 作为StoredProcedure的结果集的事件。



我想要实现的是用户可以设置数据来创建一个报告。当报告(在内存数据中,而不是表中)完成时,我希望数据库用结果集推送。因此,无法通过查询对表或视图设置 SqlDependency 查询。



可以实现吗?



我尝试了什么:



我还没试过事情呢。由于我在一个项目中使用它,我看到了另一个项目的可能性,其中我希望存储过程的输出作为数据库推送的结果集。

Hi Everyone,

In a project I have setup a SqlDependency object in c# to retrieve data from a database as PostQueryNotification. That is working OK. The query I created gets fired as event when I insert, update or delete a record in that table.

Is it possible to use SQL MessageBroker and C# SQLDependency as event for a resultset of a StoredProcedure.

What I want to achieve is that a user can set data to create a report. When the report (in memory data, not a table) is finished I want to be pushed by the database with the resultset. So the SqlDependency query cannot be set by a query on a table or view.

Can that be achieved?

What I have tried:

I haven't tried a thing yet. Since I have used it in a project I see possibilities for another project with reports where I want the output of the Stored Procedure as resultset pushed by the database.

推荐答案

这Richard Mccutchen的文章似乎是关于你所寻求的: https://dzone.com/articles/c-sqldependency-monitoring [ ^ ]



替代方案可能是更改跟踪,但我怀疑这适用于您用作结果集的内存表,请参阅此文章:在SQL Server 2008中使用更改跟踪 [ ^ ]
This article by Richard Mccutchen seems to be about what you seek: https://dzone.com/articles/c-sqldependency-monitoring[^]

An alternative might be "Change Tracking", but I doubt this will work with a memory table which you use as a result set, see this article: Using Change Tracking in SQL Server 2008[^]


这篇关于存储过程输出的Sqldependency的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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