You can use the
SqlDependency Class. Its intended use is mostly for ASP.NET pages (low number of client notifications).
ALTER DATABASE UrDb SET ENABLE_BROKER
OnChange event to get notified:
void OnChange(object sender, SqlNotificationEventArgs e)
And in code:
SqlCommand cmd = ... cmd.Notification = null; SqlDependency dependency = new SqlDependency(cmd); dependency.OnChange += OnChange;
It uses the
Service Broker (a message-based communication platform) to receive messages from the database engine.
~ Answered on 2011-03-13 09:25:27