Microsoft SQL Server 2005 Developer’s Guide- P9

Microsoft SQL Server 2005 Developer’s Guide- P9:This book is the successor to the SQL Server 2000 Developer’s Guide, which was extremely successful thanks to all of the supportive SQL Server developers who bought that edition of the book. Our first thanks go to all of the people who encouraged us to write another book about Microsoft’s incredible new relational database server: 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 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.