10

I have a pretty simple .net 4 desktop application written in c# which needs to display some data inserted to a table on an SQL Server (2005). The data itself is quite simple, just one row of about 10 columns, (mostly counts of other data).

I could just poll the sql server from the application every x interval, but my preference is to have the sql server push the data out to this application if possible, as the timing of the "new data" is often irregular.

In short, I'd like to know if this is possible. Doing some research before posting this question, I found a few possibilities.

1) SignalR: I found this question which seemed promising, but this seems to be in the context of a web application rather than a desktop one. Upon review of the signalR wiki, it seemed to me that it requires some kind of web service or other http connection which I'd prefer to avoid.

2) Sql server change tracking, from this question. Firstly, I'm not on sql 2008 so I assume I'd have to install or configure it (which isn't a problem) but I'm also not sure if this will provide what I need.

I will mention as well that this client application could exist on 100+ different pcs which would all need to be notified on the data change.

So, is such a thing possible? I apologize if the question is a little vague - and thanks in advance for your help!

Community
  • 1
  • 1
Mansfield
  • 14,445
  • 18
  • 76
  • 112

1 Answers1

4

The SQLDependencyclass is supposed to cater to the very scenario that you are referring to. While i do not have any personal experience using this, this article seems to be in line with your scenario

Jagmag
  • 10,283
  • 1
  • 34
  • 58
  • Okay, I've got that, and it's working...kind of. I'm just trying to set up the query notifications correctly on the sql server so that notifications are only sent when specific data in a table changes. – Mansfield Sep 11 '12 at 15:41
  • 1
    And I've got it working! My problem was that I needed to specify two part table names in my command. Thanks for your help! – Mansfield Sep 11 '12 at 16:59
  • I am wondering if this does use a kind of continues request underneath or if it is a true push from the sql server - anyway it seems to be NOT supported since .NET 2.0 – Martin Meeser Mar 10 '15 at 15:46