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使用查询通知

适用于

另请参阅