SqlNotificationRequest 建構函式

定義

建立 SqlNotificationRequest 類別的新執行個體。

多載

SqlNotificationRequest()

使用預設值,建立 SqlNotificationRequest 類別的新執行個體。

SqlNotificationRequest(String, String, Int32)

採用使用者定義的字串來建立 SqlNotificationRequest 類別的新執行個體,該字串會指定特定告知要求、預先定義之 SQL Server 2005 Service Broker 服務名稱,以及以秒計算的逾時期限。

SqlNotificationRequest()

使用預設值,建立 SqlNotificationRequest 類別的新執行個體。

public:
 SqlNotificationRequest();
public SqlNotificationRequest ();
Public Sub New ()

備註

如果使用無參數建構函式來 SqlNotificationRequest 建立物件,該實例必須先初始化 和 UserDataOptions 屬性,再將物件指派給 SqlCommand 對象的 Notification 屬性。 建構函式所使用的預設值為 VISUAL Basic) 中的 NULL (NothingUserData、的 Options空字串,以及 的 Timeout零。

另請參閱

適用於

SqlNotificationRequest(String, String, Int32)

採用使用者定義的字串來建立 SqlNotificationRequest 類別的新執行個體,該字串會指定特定告知要求、預先定義之 SQL Server 2005 Service Broker 服務名稱,以及以秒計算的逾時期限。

public:
 SqlNotificationRequest(System::String ^ userData, System::String ^ options, int timeout);
public SqlNotificationRequest (string userData, string options, int timeout);
new System.Data.Sql.SqlNotificationRequest : string * string * int -> System.Data.Sql.SqlNotificationRequest
Public Sub New (userData As String, options As String, timeout As Integer)

參數

userData
String

包含這個告知之特定應用程式識別項的字串, 這個字串不是由告知基礎結構所使用,不過可讓您用來使告知與應用程式狀態產生關聯。 這個參數中所指示的值會包含在 Service Broker 佇列訊息中。

options
String

包含公佈告知訊息之 Service Broker 服務名稱的字串,且該字串必須包含資料庫名稱或 Service Broker 執行個體 GUID,以便將服務名稱查閱範圍限制在特定的資料庫。

如需 options 參數格式的詳細資訊,請參閱 Options

timeout
Int32

等待告知訊息的時間 (以秒為單位)。

例外狀況

options 參數的值為 NULL。

optionsuserData 參數比 uint16.MaxValue 長,或者 timeout 參數中的值小於零。

備註

此建構函式可讓您初始化新的SqlNotificationRequest實例,並提供您自己的標識碼、SQL Server 2005 Service Broker 服務名稱,以及逾時值。

另請參閱

適用於