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 參數為 null。

SqlCommand 物件的 SqlNotificationRequest 屬性已指定 Notification 物件,但該 SqlNotificationRequest 與這個相依性沒有關聯。

備註

只有符合一組特定需求的 SELECT 陳述式才支援查詢通知。 如需詳細資訊,請參閱 SQL Server Service Broker使用查詢通知

適用於

另請參閱