Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I signal a c# console app from SQL Server?

Tags:

c#

sql-server

Rather than poll against some tables, I'd like to signal a waiting c# app that there are new rows to be processed in a table, maybe via a trigger. Is there some way for the database to signal to a console app, or am I stuck polling the table looking for new rows?

like image 260
powlette Avatar asked Mar 09 '11 20:03

powlette


People also ask

How do you make an AC signal?

An alternating current is produced by switching the potential between two terminals in a fixed time interval—the frequency. The difference in potential between the positive and negative terminal is expressed in volts.

What is an AC signal?

An AC signal is a current, voltage, or numerical sequence that consistently exhibits both positive and negative values, and a DC signal exhibits only positive values or only negative values. The following plots provide examples of AC and DC signals.

What is a AC signal with example?

AC means Alternating Current and DC means Direct Current. AC and DC are also used when referring to voltages and electrical signals which are not currents! For example: a 12V AC power supply has an alternating voltage (which will make an alternating current flow).

What is AC signal source?

Alternating current (AC), is an electric current in which the flow of electric charge periodically reverses direction, whereas in direct current (DC, also dc), the flow of electric charge is only in one direction.


2 Answers

Take a look at Query Notifications (SQL Server 2005+).

Microsoft SQL Server 2005 introduces query notifications, new functionality that allows an application to request a notification from SQL Server when the results of a query change. Query notifications allow programmers to design applications that query the database only when there is a change to information that the application has previously retrieved.

There is an example here of how to write a simple form app to register a query for notification: http://msdn.microsoft.com/en-us/library/a52dhwx7(VS.80).aspx.

This does require the Service Broker to be enabled on the database.

You should take a look at the notes in the Remarks section of the MSDN SqlDependency documentation to make sure it is the right choice for your scenario

like image 145
Pero P. Avatar answered Sep 20 '22 19:09

Pero P.


Check if SqlCacheDependency can be of any use...

http://www.asp.net/data-access/tutorials/using-sql-cache-dependencies-cs

like image 29
Jakub Konecki Avatar answered Sep 20 '22 19:09

Jakub Konecki