SqlDependency Constructor (SqlCommand)
Collapse the table of content
Expand the table of content

SqlDependency.SqlDependency(SqlCommand) Constructor

Creates a new instance of the SqlDependency class and associates it with the SqlCommand parameter.

Namespace: System.Data.SqlClient
Assembly: System.Data (in system.data.dll)

public SqlDependency (
	SqlCommand command
public SqlDependency (
	SqlCommand command
public function SqlDependency (
	command : SqlCommand
Not applicable.



The SqlCommand object to associate with this SqlDependency object. The constructor will set up a SqlNotificationRequest object and bind it to the command.

Exception typeCondition


The command parameter is NULL.


The SqlCommand object already has a SqlNotificationRequest object assigned to its Notification property, and that SqlNotificationRequest is not associated with this dependency.

Internally, this constructor creates an instance of the SqlNotificationRequest class, and binds it to a SqlCommand object.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2016 Microsoft