SqlNotificationRequest 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個新的類別實例 SqlNotificationRequest 。
多載
| 名稱 | Description |
|---|---|
| SqlNotificationRequest() |
建立一個新的類別實例 SqlNotificationRequest ,並保留預設值。 |
| SqlNotificationRequest(String, String, Int32) |
建立一個新的類別實例 SqlNotificationRequest ,包含使用者定義的字串,該字串可識別特定通知請求、預先定義的 SQL Server 2005 Service Broker 服務名稱名稱,以及以秒為單位的逾時時間。 |
SqlNotificationRequest()
建立一個新的類別實例 SqlNotificationRequest ,並保留預設值。
public:
SqlNotificationRequest();
public SqlNotificationRequest();
Public Sub New ()
備註
若使用無參數建構子建立 SqlNotificationRequest 物件,該實例必須先初始化其 UserData 與 Options 屬性,才能將物件指派給物件 SqlCommand 的 Notification 屬性。 建構子使用的預設值為 NULL(Nothing 在 Visual Basic 中)表示 UserData,空字串表示 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
包含此通知特定應用程式識別碼的字串。 通知基礎設施不會使用它,但它允許你將通知與應用程式狀態關聯。 此參數所示的值包含在服務代理佇列訊息中。
- options
- String
包含服務代理服務名稱的字串,通知訊息必須包含資料庫名稱或服務代理實例 GUID,限制服務名稱查詢的範圍僅限於特定資料庫。
關於參數格式 options 的更多資訊,請參見 Options。
- timeout
- Int32
等待通知訊息的時間,也就是幾秒鐘。
例外狀況
參數值 options 為 NULL。
options或userData參數長uint16.MaxValue於或參數中的timeout值小於零。
備註
此建構子允許您初始化一個新 SqlNotificationRequest 實例,提供您自己的識別碼、SQL Server 2005 服務代理服務名稱及逾時值。