共用方式為


NotificationClassProtocol.ProtocolFields Property

Gets the collection of protocol header field definitions for the delivery protocol.

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

語法

'宣告
Public ReadOnly Property ProtocolFields As ProtocolFieldCollection
public ProtocolFieldCollection ProtocolFields { get; }
public:
property ProtocolFieldCollection^ ProtocolFields {
    ProtocolFieldCollection^ get ();
}
/** @property */
public ProtocolFieldCollection get_ProtocolFields ()
public function get ProtocolFields () : ProtocolFieldCollection

屬性值

A ProtocolFieldCollection object that represents the protocol header fields for the delivery protocol.

備註

Header fields are technically optional, but may be required by specific delivery protocols. For example, the built-in Simple Mail Transfer Protocol (SMTP) delivery protocol requires Subject, From, and To fields.

If you update the fields, updating the application deletes and re-creates the notification class to which it corresponds. This includes dropping and re-creating the Microsoft SQL Server tables used by this notification class. Any data existing in the existing notification class tables is permanently deleted.

範例

The following examples show how add a protocol field that references a notification field. The field is added at a specific position in the protocol field collection:

ProtocolField fileProtocolField3 = 
    new ProtocolField(fileProtocol, "Price");
fileProtocolField3.FieldReference = "FormattedPrice";
fileProtocol.ProtocolFields.Add(fileProtocolField3, 1);
Dim fileProtocolField3 As ProtocolField = _
    New ProtocolField(fileProtocol, "Price")
fileProtocolField3.FieldReference = "FormattedPrice"
fileProtocol.ProtocolFields.Add(fileProtocolField3, 1)

The following examples show how add a protocol field that uses an expression to compute the value. The field is added to the end of the collection:

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)

執行緒安全性

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 的硬體和軟體需求>。

請參閱

參考

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

其他資源

Fields Element for Protocol (ADF)
設定傳遞通訊協定