473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

ASp.NET app not receiving SQLDependancy notification

I have the following code.

I get an initial Subscribe event but then I get no notification in the app.

I call SqlDependency.Start(DatabaseProviderHelper.Connect ionString); on the
web app application_Start event

I started my web app and after receiving Starting the dependancy I ran a
query against the table in the Management Studio to update the table. I saw
that AspNet_SqlCacheTablesForChangeNotification's changeId for that table
was incremented. Also the Service Broker information is set up. Yet I
dont' receive any notification when the table is changed.

I've also run the following hot fix.
http://support.microsoft.com/kb/913364/EN-US/

Any thoughts??

public static void SetUserListDependancy()
{
SQLServerDatabaseAccessor dba = null;
IDataReader dr = null;

activeUsers.Clear(); //hashtable

try
{
dba =
(SQLServerDatabaseAccessor)DatabaseProviderHelper. GetDatabaseAccessor();
dba.SetStoredProc("procWebAppUsersGetActiveUsers") ;

dba.Command.Notification = null;
SqlDependency dependancy = new SqlDependency(dba.Command);
dependancy.OnChange += new OnChangeEventHandler(OnChange);
dba.OpenConnection();
dr = dba.GetDataReader();

while (dr.Read())
{
activeUsers.Add(dr["WindowsUserName"], dr["UserID"]);
}
}
catch (Exception e)
{
//do something here
}
finally
{
if (dr != null)
dr.Close();
if (dba != null)
dba.CloseConnection();
}

}

static void OnChange(object sender, SqlNotificationEventArgs e)
{
if(e.Type == SqlNotificationType.Change)
{
SqlDependency dependency = sender as SqlDependency;

// Notices are only a one shot deal
// so remove the existing one so a new
// one can be added

dependency.OnChange -= OnChange;

//fill the list again
SetUserListDependancy();
}
}
Jun 27 '07 #1
0 1107

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with...
1
by: Bruce | last post by:
The following message was a request made by sxbyl (sxbyl@netway.net.cn) on 2003-04-29 19:23:34 PST. I attempted to email this person but the email was non-delivered. >>>>>>>>> I have look at...
3
by: Robert W. | last post by:
I have a separate thread that handles data transfer operations (with a mobile device). I've set things up so that a small notification form is displayed in the lower right corner of the window. ...
0
by: Erwin Hill | last post by:
Hi guys, I have a weird problem. I wrote an application that has 2 UI threads both windows are top-level. When I insert my USB disk on key into computer I receive several WM_DEVICECHANGE which...
0
by: Ed Lukoski | last post by:
I'm trying to send mail (via our Exchange v5.5 server) from a VB.Net webapp and get Delivery Notification and Read Receipt. If I use mail.Headers.Add("Return-Receipt-To", "mailbox@whatever.com")...
2
by: SB | last post by:
Can someone please tell me Microsoft .NET's position on this WS-Notification specification that includes the pub/sub model? Is there something in the pipeline or already available as part of the...
0
by: petemo94 | last post by:
Folks, I've written a C# application that monitors files on a remote server for "Change" only. I can use explorer to view the remote system using a UNC path. From this I can open and change this...
0
by: vsrprasad16 | last post by:
Hi All, I am implementing a notification form similar to outlook email notification. my application call this notification form from a dll. this dll includes a form class and this dll has some...
4
markmcgookin
by: markmcgookin | last post by:
Has anyone used the notification class from Windows CE forms? using the following code using Microsoft.WindowsCE.Forms; ... Notification note = new Notification()
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.