ProtocolField Constructor (NotificationClassProtocol, String)

Initializes a new instance of the ProtocolField class with a parent NotificationClassProtocol and a field name.

命名空间: Microsoft.SqlServer.Management.Nmo
程序集: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

语法

声明
Public Sub New ( _
    notificationClassProtocol As NotificationClassProtocol, _
    name As String _
)
public ProtocolField (
    NotificationClassProtocol notificationClassProtocol,
    string name
)
public:
ProtocolField (
    NotificationClassProtocol^ notificationClassProtocol, 
    String^ name
)
public ProtocolField (
    NotificationClassProtocol notificationClassProtocol, 
    String name
)
public function ProtocolField (
    notificationClassProtocol : NotificationClassProtocol, 
    name : String
)

参数

  • name
    A String, between 1 and 128 characters in length, that specifies the name of the protocol field.

    You cannot change the name. To rename a protocol field, you must remove the field and the add a new field that has the new name.

备注

Field names can contain letters, numbers, and the special characters _, #, @, and $. They must also conform to Microsoft SQL Server identifier conventions. For more information about SQL Server identifiers, see 标识符.

示例

The following examples show how to define a protocol field and add it to a protocol definition in a notification class:

ProtocolField smtpProtocolField1 = 
    new ProtocolField(smtpProtocol, "Subject");
smtpProtocolField1.SqlExpression = 
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())";
smtpProtocol.ProtocolFields.Add(smtpProtocolField1);
Dim smtpProtocolField1 As ProtocolField = _
    New ProtocolField(smtpProtocol, "Subject")
smtpProtocolField1.SqlExpression = _
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())"
smtpProtocol.ProtocolFields.Add(smtpProtocolField1)

平台

开发平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

目标平台

有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。

请参阅

参考

ProtocolField Class
ProtocolField Members
Microsoft.SqlServer.Management.Nmo Namespace

其他资源

FieldName Element for Protocol/Fields/Field (ADF)
指定传递协议名称和字段