SqlDependency.AddCommandDependency(SqlCommand) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將物件 SqlCommand 與此 SqlDependency 實例關聯。
public:
void AddCommandDependency(System::Data::SqlClient::SqlCommand ^ command);
public void AddCommandDependency(System.Data.SqlClient.SqlCommand command);
member this.AddCommandDependency : System.Data.SqlClient.SqlCommand -> unit
Public Sub AddCommandDependency (command As SqlCommand)
參數
- command
- SqlCommand
一個 SqlCommand 包含對通知有效陳述的物件。
例外狀況
參數為 command 空。
物件 SqlCommand 已經有一個 SqlNotificationRequest 物件被指派到它的 Notification 屬性,且 SqlNotificationRequest 該物件並未與此相依關係相關聯。
備註
只有符合特定需求的SELECT語句才支持查詢通知。 欲了解更多資訊,請參閱 SQL Server Service Broker 及 Working with Query Notifications。