473,796 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.S tart(DatabasePr oviderHelper.Co nnectionString) ; on the
web app application_Sta rt 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_SqlCache TablesForChange Notification'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 SetUserListDepe ndancy()
{
SQLServerDataba seAccessor dba = null;
IDataReader dr = null;

activeUsers.Cle ar(); //hashtable

try
{
dba =
(SQLServerDatab aseAccessor)Dat abaseProviderHe lper.GetDatabas eAccessor();
dba.SetStoredPr oc("procWebAppU sersGetActiveUs ers");

dba.Command.Not ification = null;
SqlDependency dependancy = new SqlDependency(d ba.Command);
dependancy.OnCh ange += new OnChangeEventHa ndler(OnChange) ;
dba.OpenConnect ion();
dr = dba.GetDataRead er();

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

}

static void OnChange(object sender, SqlNotification EventArgs e)
{
if(e.Type == SqlNotification Type.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.OnCh ange -= OnChange;

//fill the list again
SetUserListDepe ndancy();
}
}
Jun 27 '07 #1
0 1123

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

Similar topics

0
8375
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 a handler. The handler portion seems to fail indicating that my parameters are invalid. I am getting an error code 126 when i try to register the handler and 28 when i register for event notification. Any ideas as to what the deal is? I am...
1
8960
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 the framework about Microsoft.Win32 namespace and System.IO namespace, but I have not found any method or delegate to receive the registry change notification. Must I use the raw API such as RegNotifyChangeKeyValue, RegOpenKeyEx, and RegCloseKey ?
3
3086
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. This all works fine. But what I can't figure out how to do is to get it to display on top of my main form, if the main form is maximized. I've tried all of the following: statusForm = new frmNotify(); statusForm.Show(); // Display...
0
1804
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 are sent trough PostMessage and WM_DEVICECHANGE with wParam set to DBT_DEVICEARRIVAL and this one is sent to me through SendMessage(by windows) I checked this through Spy++(I don't know why last one is sent through SendMessage). The
0
3325
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") I can get a delivery notification to work - but so what? That only (apparently) means that the mail server accepted it and tossed it into the user's mailbox. I want to use mail.Headers.Add("Disposition-Notification-To",
2
3506
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 .NET or WSE? -- Kind regards, SB
0
1100
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 file and I get properly notified via: watcher = new FileSystemWatcher(); watcher.Changed += new FileSystemEventHandler(OnFileEvent);
0
1631
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 object value to display the contents on form. i am filling the form with the object before "form.show." form has some timer to implement hide and fading. my problem is when ever form is showing, the focus goes to form from current application(any)...
4
3320
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
9535
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10465
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10242
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9061
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5453
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.