共用方式為


NotificationServices Class

Represents a Notification Services server.

命名空間: Microsoft.SqlServer.Management.Nmo
組件: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

語法

'宣告
Public NotInheritable Class NotificationServices
    Inherits NamedSmoObject
public sealed class NotificationServices : NamedSmoObject
public ref class NotificationServices sealed : public NamedSmoObject
public final class NotificationServices extends NamedSmoObject
public final class NotificationServices extends NamedSmoObject

備註

更新的文字:2006 年 4 月 14 日

Use the NotificationServices class to enumerate the Notification Services instances on an instance of the SQL Server 2005 Database Engine.

If you attempt to enumerate instances on a SQL Server 2000 instance, Notification Services throws an exception.

When using SQL Server Authentication to connect to a Notification Services instance via Notification Services Management Objects (NMO), you use a Server object to obtain a NotificationServices reference, and then use this reference to get a Notification Services instance. When creating an instance of the Server object, you can specify a ServerConnection object that uses a SqlConnection object.

If you are using SQL Server Authentication to call instance and application management methods such as Create, Update, Drop, Enable, or Disable, the SqlConnection must not already be open.

Make sure the SqlConnection is not opened before the Server object instance is created, or else use another ServerConnection constructor that does not use a SqlConnection object.

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.Management.Smo.SmoObjectBase
     Microsoft.SqlServer.Management.Smo.SqlSmoObject
       Microsoft.SqlServer.Management.Smo.NamedSmoObject
        Microsoft.SqlServer.Management.Nmo.NotificationServices

範例

The following examples show how to use the Notification Services class to get information about instances of Notification Services:

// Specify the Database Engine instance that hosts the 
// Notificaiton Services instance and get a reference to 
// the NotificationServices object.
smo.Server server = new smo.Server("MyServer");
nmo.NotificationServices notificationServices = server.NotificationServices;

// Get the Notification Services instance.
nmo.Instance nsinst = notificationServices.Instances ["Tutorial"];

// Get the instance's collection of delivery channels.
nmo.DeliveryChannelCollection dcCollection = nsinst.DeliveryChannels;

// Enumerate the delivery channels.
foreach (nmo.DeliveryChannel dc in dcCollection)
{
    Console.WriteLine(dc.Name);
}
' Specify the Database Engine instance that hosts the 
' Notificaiton Services instance and get a reference to 
' the NotificationServices object.
Dim server As New smo.Server("nsuetest")
Dim notificationServices As nmo.NotificationServices = _
    server.NotificationServices

' Get the Notification Services instance.
Dim nsinst As nmo.Instance = _
    notificationServices.Instances("Tutorial")

' Get the instance's collection of delivery channels.
Dim dcCollection As nmo.DeliveryChannelCollection = _
    nsinst.DeliveryChannels

' Enumerate the delivery channels.
Dim dc As nmo.DeliveryChannel
For Each dc In dcCollection
    Console.WriteLine(dc.Name)
Next

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

NotificationServices Members
Microsoft.SqlServer.Management.Nmo Namespace
Server