SqlCommand command = new SqlCommand("Select * from Table");// Clear any existing notifications command.Notification = null;...// Create the dependency for this command SqlDependency dependency = new SqlDependency(commmand); // Add the event handlerdependency.OnChange += new OnChangeEventHandler(OnChange);voidOnChange(object sender, SqlNotificationEventArgs e){ SqlDependency dependency = sender as SqlDependency; dependency.OnChange += OnChange; //Handler for Object OnAnyEvent();}
No comments:
Post a Comment