Partilhar via


ProtocolField Constructor (NotificationClassProtocol, String)

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

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntax

'Declaration
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
)

Parameters

  • 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.

Remarks

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 Identifiers.

Example

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)

Platforms

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

See Also

Reference

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

Other Resources

FieldName Element for Protocol/Fields/Field (ADF)
Specifying the Delivery Protocol Name and Fields