Groups | Blog | Home
all groups > sql server notification services > march 2006 >

sql server notification services : recurring notifications


skg
3/10/2006 11:27:40 AM
i am finding the notification is triggered only once when the field changes
first time. Its not triggered second time. How can i have it trigger
everytime there is a change in the field.

Here is code snippet. thx

....

...static void Main()

{

SqlCommand cmd = new SqlCommand("SELECT au_id, au_lname FROM dbo.authors",
conn))

SqlDependency depend = new SqlDependency(cmd, null,0);

depend.OnChange += new OnChangeEventHandler(MyOnChanged);

conn.Open();

SqlDataReader rdr = cmd.ExecuteReader();

....

....

}

MyOnChanged(object caller, SqlNotificationEventArgs e)

{

Console.WriteLine("result has changed");

Console.WriteLine("Source " + e.Source);

Console.WriteLine("Type " + e.Type);

Console.WriteLine("Info " + e.Info);

}


skg
3/10/2006 5:13:06 PM
Looks like i have to use threading!
http://msdn2.microsoft.com/en-us/library/3ht3391b(VS.80).aspx

[quoted text, click to view]

Joe Webb
3/11/2006 12:00:00 AM
Since your question is about SqlDependency and Query Notifications,
you'll probably have more luck in another newsgroup - may
microsoft.public.sqlserver.programming. This one is for SQL Server
Notification Services.



--
Joe Webb
SQL Server MVP
http://www.sqlns.com


~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811

I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)


[quoted text, click to view]
skg
3/11/2006 9:55:16 AM
Thanks!!! Joe
[quoted text, click to view]

AddThis Social Bookmark Button