Click here to Skip to main content
15,880,427 members
Everything / SqlDependency

SqlDependency

SqlDependency

Great Reads

by Charaf Dadoua
SQL dependency with C#.NET and SQL Server 2012
by Christian Del Bianco
SqlTableDependency is a component used to receive database notifications containing the record values inserted, deleted or update on a database table.
by Herman.Instance
When using SqlDependency, is it possible that a detected change leads to 0 rows in the SqlDependency results?

Latest Articles

by Herman.Instance
When using SqlDependency, is it possible that a detected change leads to 0 rows in the SqlDependency results?
by Christian Del Bianco
SqlTableDependency is a component used to receive database notifications containing the record values inserted, deleted or update on a database table.
by Charaf Dadoua
SQL dependency with C#.NET and SQL Server 2012

All Articles

Sort by Score

SqlDependency 

6 Nov 2013 by ilprincipe
hello, if I understand correctly, the problem is in your query, because SqlDependency does not allow subqueries.I think this link[^] can help you.
23 Jan 2017 by Richard Deeming
It looks like you're missing a vital step:Detecting Changes with SqlDependency[^]5. Execute the command using any of the Execute methods of the SqlCommand object. Because the command is bound to the notification object, the server recognizes that it must generate a notification, and the...
11 Aug 2018 by Arsenije Arsenijevic
I know the question is old, but I see it's not answered, just referenced to a working example. You're creating new SqlDependency objects on each call of the GetAllUsers method (which I presume is not called just once) and not stopping the old-ones. This results in multiple SqlDependency objects...
12 May 2020 by Richard Deeming
That query cannot be used with a SqlDependency: Creating a Query for Notification | Microsoft Docs[^]: Query notifications are supported for SELECT statements that meet the following requirements: … The statement must not contain subqueries… …...
6 Jan 2013 by Anurag Sable
I know there are lot of questions that might be similar to this, But I am confused a bit.My only question is, I want to track database to know what is changed and get the details of the changed record, And then insert this chaged row into another table. Is this possible with SQL Dependency...
6 Jan 2013 by Sandeep Mewara
AFAIK, using TRIGGERS you can create referencing entities and thus use SQL dependency to track the changes. A quick overview of SQL dependency here: MSDN: Understanding SQL Dependencies[^]
16 Jan 2013 by Dharmenrda Kumar Singh
We have a application where users are entering their time efforts .We have two tables, Production table for entering all production tasks and NonProduction for entering all non production related tasks in the application.We also have a UserInfo table where all the user information is stored like...
27 Jan 2013 by Lance Parker
I am hoping some one can help with my problem regarding SqlDependency, to which I have found plenty of information on google but nothing regarding my specific problem. The program I am currently writing is an ADO.Net application in windows forms and implements 3 layer architecture, plus uses...
27 Jan 2013 by Zoltán Zörgő
If you have a presentation layer, use it as such, and don't try to make it do what's not it's purpose. If your PL is thick, you should implement a messaging feature to notify the PL, and ask it to refresh the data. If it is thin, you should do scheduled callback on PL side to check if there is...
12 Jun 2013 by Ahmad Negm
My main reference when developing this application is : http://msdn.microsoft.com/en-us/library/a52dhwx7(v=vs.80).aspx[^]I have a table in a database, and there is a windows service insert some rows randomly in this table. Then, my application gets these rows from the table and view it in a...
12 Jun 2013 by Espen Harlinn
Have you considered using a queue? CREATE QUEUE[^]Or perhaps the Service Bus? Service Bus 1.0 download[^]Best regardsEspen Harlinn
24 Aug 2013 by M_Mogharrabi
Hi all,Is there any way to use LEFT OUTER JOIN command with sqldependency?
4 Nov 2013 by Pheonyx
Hi Guys,I was wondering if you could help me as I am a bit stumped at the moment.I am trying to use the SQLDependency object(s) to write a windows service for sending e-mails upon the creation of entries in a table.My DAL is produced using Entity Framework version 5 and is working for...
16 Jan 2014 by Member 9438299
I'm using SQLDependency to catch changes in my database. http://code.msdn.microsoft.com/How-to-use-SqlDependency-5c0da0b3This code really works. When I'm changing something in table, event is fired.private void RefreshWithSqlDependency() { iquery = from order in context.Order...
30 Sep 2014 by miss786
I am trying to implement a sqlDependency task, which can automatically refresh the page, whenever I insert new data into my desired database table.The code below, is not refreshing the content automatically, when I insert new data into the database table. if I refresh it the page, manually,...
30 Sep 2014 by Mukesh Ghosh
To implement SQL dependency you needs to add paramter in Config as well.
30 Sep 2014 by Suvabrata Roy
Hi,Here is a very good article on SQL Dependency : Query Notification using SqlDependency and SqlCacheDependency[^]If you required run time data push at client you can use SignalR :http://www.asp.net/signalr[^]
11 Aug 2018 by Member 11467752
I'm developing a notification system using SqlDependency and signalR, the problem I can't deal with is when I change the attribute value "IsOnline" in DB to True or False based on attendee status, OnChange event fires many times, first time a new user log in I get two notifications then the...
26 Jul 2015 by Wendelius
First of all the notification may occur even if there is no actual change in the data. This may happen for example if the server is under heavy load or even problems with the notification may trigger the event. You can try using HasChanges[^] if it shows the situation differently.One thing...
19 Apr 2016 by Herman<T>.Instance
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#...
19 Apr 2016 by RickZeeland
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...
23 Jan 2017 by Andy Lanng
Hi ^_^I want to watch a Configuration table for any changes. This table essentially contains user settings that can be over-ridden by an Admin. If some functionality or access is turned off, then I need to alert the client side (using web sockets).The issue is that the Admin app and...
7 Mar 2017 by MHD Salim Al-Tarsha
Helloi have developed c# application that connects to sql servermy sql server database contains about 20 tables.a user(1) asks for table records , the application connects to the server and sql command is executed to fill the data into gridviewthe problem is when another user(2) updated...
7 Mar 2017 by #realJSOP
You have to set it up yourself. One way would be to have an audit table that stores info regarding changes to a table. I would probably go with the following schema:LastChanged datetimeTableName nvarchar(64)and write stored proc that returns the count of records that were added for a...
27 Apr 2017 by Member 11178806
hi i am working with Signal r and sql dependency . i have created one demo for such requirement that if i update in database . it will auto change ui content. its working fine but when i tried to use group by clause or top or Rownum . Sql dependency Change event is not firing and it does not...
27 Apr 2017 by Maciej Los
SQL Dependency class is used to detect when query results differ from those originally retrieved. So, if there's no changes between query calls, SqlDependency class won't notify user about changes. See: Detecting Changes with SqlDependency[^] SqlDependency Class (System.Data.SqlClient)[^]
27 Apr 2017 by Member 11178806
Than for Answering. But i have already mentioned that if i am using group by , top, distinct such clause and trying to update value from database , still event is not firing...
12 Nov 2017 by Jörgen Andersson
Is Query notifications ON on the server? Enabling Query Notifications | Microsoft Docs[^]
21 Mar 2018 by Herman<T>.Instance
Hi, has anyone ever succeeded to have the ServiceBroker in SQL Server not run on schema DBO (default) but on lower levels like db_datareader? What I have tried: I can't get it done. I have to set up the created user to have db_owner schema rights. For my purpose that is an overkill.
21 Mar 2018 by RickZeeland
Well, you seem to get no reactions, so maybe it's time to start thinking about PostgreSQL. Here's an article about notifications in PostgreSQL: A PostgreSQL Notification Example[^] BTW an alternative might be SQL Server change tracking: About Change Tracking (SQL Server) | Microsoft Docs[^]
21 Mar 2018 by Richard Deeming
Can't say I've tried it, but between these two: kreel bits: Microsoft SQL Useful Database Role for Service Broker: db_servicebroker[^] minimum account permissions for service broker[^] it's supposed to work so long as you have: RECEIVE on queues SEND on FROM service REFERENCES on contract ...
7 May 2018 by Herman<T>.Instance
Hi Folks, in my asp.net website I have signalR installed and when an exception is recorded in the Errors Table of my MS SQL Server the SqlDependency is run, the error is received from the db, the ErrorHub sends the message to all context.Clients.all.... My page shows a pnael with the message...
7 May 2018 by Herman<T>.Instance
Issue is solved. It was a caching thing in the browser...
12 May 2020 by mohamad_ali
hi i am using sqldependecy to get notify from sqlserver and use signalr for send alarm to some users that store in database before that i sent alarm for all user and use simple select but now i want using complex select What I have tried: ...
12 Jun 2015 by Charaf Dadoua
SQL dependency with C#.NET and SQL Server 2012
3 Jul 2017 by Christian Del Bianco
SqlTableDependency is a component used to receive database notifications containing the record values inserted, deleted or update on a database table.
17 Apr 2015 by ranjeet11
i wants to monitor multiple table changes using SQL Dependency.it will work for single object but while creating multiple objects , it will work only for last object called in form load.i use this DEMO ApplicationUsing SqlDependency for data change events[^].i found AggregateCacheDependency...
23 Nov 2017 by RDBurmon
yes it possible Maybe this will help. http://www.codeproject.com/KB/database/chatter.aspx
21 May 2019 by Herman<T>.Instance
When using SqlDependency, is it possible that a detected change leads to 0 rows in the SqlDependency results?
7 Mar 2014 by mcihany
why ı cant get changes when ı use lef join in sql query? if ı use inner join it works but with left join it doesnt.
13 Jun 2013 by Ahmad Negm
Thanks Espen for you kindly support, but let me show you my new code and explain its problem.Now, this is my new clear code scenario and its problem is that the user can't use UI controls when the SqlDependency receives a set of rows sequentially. What I want exactly is that how to allow...
12 Nov 2017 by Member 13463350
SqlConnection cn; SqlCommand cmd; SqlDependency dependency; DataTable dt; static string obj= string.Empty; public Form1() { InitializeComponent(); CheckForIllegalCrossThreadCalls = false; try { SqlClientPermission perm = new...
12 Nov 2017 by Member 13463350
there is no one who can help me
13 Nov 2017 by Member 13463350
yes open.Info value is Invalid when I run the code.
23 Nov 2017 by Member 13463350
string connection="My connection String"; string obj1; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { Method1(); Method2(); } private bool DoesUserHavePermission() { try { SqlClientPermission clientPermission = new ...