Questions tagged [sqldependency]

The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler.

The SqlDependency object represents a query notification dependency between an application and an instance of SQL Server. An application can create a SqlDependency object and register to receive notifications via the OnChangeEventHandler event handler.

MSDN Documentation

454 questions
50
votes
7 answers

What are the limitations of SqlDependency?

I am using a table as a message queue and "signing up" for updates by using a SqlDependency. Everywhere I read, people are saying "look out for the limitations of it" but not specifically saying what they are. From what I've gathered, you will have…
fluf
  • 1,261
  • 2
  • 22
  • 36
44
votes
2 answers

SqlDependency Reliablity?

My current situation is that I have an application that needs to be notified when new data arrives in a database table. The data is coming from an external source (that I have no control over--this is this only integration option). When new data…
Phil Sandler
  • 27,544
  • 21
  • 86
  • 147
42
votes
1 answer

SqlDependency Losing Subscription Over Time

I've been using SqlDependency in a .NET 3.5 application for over 3 years without any problems. The scenario is as follows: Central windows service with a SqlDependency watching a table (let's call this Table A) Multiple users using a WPF…
Michael Bowersox
  • 1,471
  • 11
  • 17
30
votes
6 answers

SQLDependency_OnChange-Event fires only one single Time

I'm working with SQLDependency to notify me if there is a change in the Database. After Program Start-Up it works just fine. When I make a first change the Event fires. Wohoo... that's great. But if I made a second change the event doesn't fire…
mj2k2
  • 311
  • 1
  • 3
  • 6
26
votes
1 answer

SqlDependency - How do I interpret the SqlNotificationEventArgs properties?

I'm using the SqlDependency class and have been trying unsuccessfully to find a list of possible combinations of the Type, Source and Info properties of the SqlNotificationEventArgs object. This is the closest I've found so far. However, I know…
drs9222
  • 4,448
  • 3
  • 33
  • 41
25
votes
3 answers

I want my database (SQL) to notify or push updates to client application

I was developing this application on VB.net 2010 and SQL 2008. I wanted the clients to be notified for updates on the db, and the application used to check the db for changes in the specified minute using a timer, which really is not efficient. I…
25
votes
1 answer

Using SqlDependency vs. periodic polling of a table (performance impact)

In the beginning of our app's development, we were using SqlDependency quite heavily to cache DB results until the notifications told our app to grab a fresh copy. During testing, we've noticed that the SQL DB's performance was getting hammered by…
SLoret
  • 1,531
  • 3
  • 18
  • 31
15
votes
1 answer

Getting SqlChangeMonitor to work

I am trying to get the new SqlChangeMonitor feature included in the System.Runtime.Caching namespace to work and am getting some unexpected results. I have a simple console application setup as: static void Main(string[] args) { var cacher = new…
SonOfPirate
  • 5,642
  • 3
  • 41
  • 97
14
votes
1 answer

How do I clean SqlDependency from SQL Server memory?

How do I clean up the SQL Server to get rid of expired SqlDependency objects? After I receive the event from the SqlDepedency object, I need to create a new one before I can get a new event. However, the memory use of the SQL Server process climbs…
JeremyK
  • 1,075
  • 1
  • 22
  • 45
13
votes
7 answers

Getting data from SqlDependency

I've got a table and a SqlDependency that is waiting for new inserts. OnChange fires as I need, but I don't understand if it's possible to get the row which cause the databse change. SqlDependency sql command: SqlCommand cmd = new…
Philipp
  • 355
  • 2
  • 4
  • 11
11
votes
1 answer

SqlDependency Change/Error/Client error after a long time

I got a Windows service listening to inserts in a table using the SqlDependency class. It works fine for several days but then suddenly stops working. In the normal scenario, I receive change events e.Type = SqlNotificationType.Change e.Info…
adrianm
  • 14,468
  • 5
  • 55
  • 102
11
votes
2 answers

Using SqlDependency with named Queues

I have the following code that uses SqlDependency to monitor changes in one of my databases It works great, except every run it generates its own Queue/Service/Route with a guid in the database: Class: class SqlWatcher { private string…
Bert Wagner
  • 851
  • 1
  • 11
  • 23
11
votes
1 answer

SqlDependency with EntityFramework 6 (async)

I'm using the EF 6 async querying features, such as var list = await cx.Clients.Where(c => c.FirstName.Length > 0).ToListAsync(); I want to also start SQL dependencies on these queries so that I can get notified when the data in the database…
user1032657
  • 2,451
  • 6
  • 28
  • 38
10
votes
2 answers

SqlDependency.OnChange firing but SqlDataReader is not returning with data

When I execute a query with a datetime column filter WHERE [Order].CreatedOn >= @CreatedOn using a SqlDependency, the change on data source fires the SqlDependency.OnChange event but the SqlDataReader associated with the SqlCommand doesn't return…
Khadim Ali
  • 2,548
  • 3
  • 33
  • 61
9
votes
2 answers

SqlTableDependency onchange event not fired

i have an issue with SqlTableDependency. My Changed method is not invoked when i make insert/update/delete to desire table. OnStatusChanged event works OK. string conn = @"data source=secret server; integrated security=True; initial catalog=secret…
Kuba Wenta
  • 580
  • 1
  • 5
  • 25
1
2 3
30 31