Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 19-Apr-16 0:20am

1 solution

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[^]
 
Share this answer
 
v2
Comments
Herman<T>.Instance 19-Apr-16 7:50am    
Unfortunately they use a Stored procedure in the SQL Dependency to see data changes in the used table in the stored procedure. I run a stored procedure in the database. That result set should be sent to the SqlDependency. So how can the SqlDependency know that there is a result from a stored procedure? It holds in memory tabledata and not a stored on device table with data

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900