SqlDependency.AddCommandDependency(SqlCommand) 方法

定義

將物件 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 BrokerWorking with Query Notifications

適用於

另請參閱