TAILIEUCHUNG - Microsoft SQL Server 2005 Developer’s Guide- Part 19

Microsoft SQL Server 2005 Developer’s Guide- P19:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 5 Developing with Notification Services 159 Figure 5-7 Adding a reference to the Notification Services library Next add an import directive for the NotificationServices namespace to the Declarations section of your project. Using the import directive enables you to use the classes in the NotificationServices namespace without requiring you to fully qualify the names. The import directive appears as follows Imports After adding the reference to your project and its associated namespace you can create the code to add a subscriber to your Notification Services application. Listing Subscriptions To list the subscriptions that have been created on a Notification Services instance you can use the SubscriberEnumeration object as is shown in the following listing Create the Instance object Dim myNSInstance As New NSInstance NSAppInstance Populate the list box Dim oSubscribers As SubscriberEnumeration New _ SubscriberEnumeration myNSInstance Iterate through a collection 160 Microsoft SQL Server 2005 Developer s Guide For Each oSub As Subscriber In oSubscribers Add each Subscriber Name to the List Next At the top of this listing you can see where the Notification Services instance called MyNSInstance is created. The important thing to notice in this line is the fact that the value MSAppInstance must match the value defined in your ICF file. This value can also been found by using SQL Server Management Studio to open the Notification Services node that lists the active instances. Next a new instance of the SubscriberEnumeration object called oSubscribers is created and a For-Each loop is used to iterate through the collection of subscribers exposed by the SubscriberEnumeration object. Within the For-Each loop the name of each subscriber is added to a ListBox that can be displayed to the end user. Adding Subscriptions Of course before you can list subscribers you must .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.