[Top] [All Lists]

Re: Subscriber.Enabled() returning incorrect result

Subject: Re: Subscriber.Enabled() returning incorrect result
From: Joe Webb
Date: Tue, 26 Jul 2005 15:05:12 -0500
Newsgroups: microsoft.public.sqlserver.notificationsvcs
Hi Pinal - 

This code snippet demonstrates how to use the SubscriberEnumeration
object to retrieve a subscriber object and view its Enabled property
in a Label. 

private void button1_Click(object sender, System.EventArgs e)
        //the subscriber id we will work with
        string subId = "[email protected]";

        //Create an NSInstance object
        string instanceName = "myNotifyInstance";
        NSInstance instance;
        instance = new NSInstance(instanceName);

        //create disable an existing subscriber
        Subscriber subscriber =new Subscriber(instance);
        subscriber.SubscriberId = subId;
        subscriber.Enabled = false;
        //create a new subscriber object
        Subscriber subscriber2 = new Subscriber(instance);
        //set the subscriberId
        subscriber2.SubscriberId = subId;

        //Create a SubscriberEnumeration object
        SubscriberEnumeration subscribers = new

        //retrieve the subscriber object 
        subscriber2 = subscribers[subId];

        //check the enabled property
        label1.Text = subscriber2.Enabled.ToString();



Joe Webb
SQL Server MVP

Get up to speed quickly with SQLNS 

I support PASS, the Professional Association for SQL Server.

On Tue, 26 Jul 2005 13:32:48 GMT, "Pinal P via"
<[email protected]> wrote:

>I am giving my users the ability to disable their account from my NS front-
>end web app and to do that I am using the NS API. 
>In order to disable the subscriber account, I
>- instantiate a Subscriber object for the subscriber
>- set its Enabled property to False
>- call the Update() method
>The problem is, when I create another Subscriber instance for the same
>subscriber somewhere else and check the subscriber.Enabled() property, it
>always returns True (even if I restart the app), whereas the database is
>showing that the subscriber account is disabled. Any idea why this is

<Prev in Thread] Current Thread [Next in Thread>