Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Fri, 10 Mar 2006 11:27:40 -0600,    group: microsoft.public.sqlserver.notificationsvcs        back       


recurring notifications   
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);

}
date: Fri, 10 Mar 2006 11:27:40 -0600   author:   skg

Re: recurring notifications   
Looks like i have to use threading!
http://msdn2.microsoft.com/en-us/library/3ht3391b(VS.80).aspx

"skg"  wrote in message 
news:%23Pu$vfGRGHA.4696@tk2msftngp13.phx.gbl...
>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);
>
> }
>
>
>
date: Fri, 10 Mar 2006 17:13:06 -0600   author:   skg

Re: recurring notifications   
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)


On Fri, 10 Mar 2006 17:13:06 -0600, "skg"  wrote:

>Looks like i have to use threading!
>http://msdn2.microsoft.com/en-us/library/3ht3391b(VS.80).aspx
>
>"skg"  wrote in message 
>news:%23Pu$vfGRGHA.4696@tk2msftngp13.phx.gbl...
>>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);
>>
>> }
>>
>>
>> 
>
date: Sat, 11 Mar 2006 07:34:10 -0600   author:   Joe Webb

Re: recurring notifications   
Thanks!!! Joe
"Joe Webb"  wrote in message 
news:9ck512pjpjbnc126l4v3l3aund6b7sojtk@4ax.com...
> 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)
>
>
> On Fri, 10 Mar 2006 17:13:06 -0600, "skg"  wrote:
>
>>Looks like i have to use threading!
>>http://msdn2.microsoft.com/en-us/library/3ht3391b(VS.80).aspx
>>
>>"skg"  wrote in message
>>news:%23Pu$vfGRGHA.4696@tk2msftngp13.phx.gbl...
>>>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);
>>>
>>> }
>>>
>>>
>>>
>>
date: Sat, 11 Mar 2006 09:55:16 -0600   author:   skg

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us