Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a new instance of the SqlDependency class.
SqlDependency() |
Creates a new instance of the SqlDependency class with the default settings. |
SqlDependency(SqlCommand) |
Creates a new instance of the SqlDependency class and associates it with the SqlCommand parameter. |
SqlDependency(SqlCommand, String, Int32) |
Creates a new instance of the SqlDependency class, associates it with the SqlCommand parameter, and specifies notification options and a time-out value. |
Creates a new instance of the SqlDependency class with the default settings.
public:
SqlDependency();
public SqlDependency();
Public Sub New ()
The constructor initializes the SqlDependency object using the default Service Broker service name and time-out. At some point after construction, you must use the AddCommandDependency method to associate one or more commands to this SqlDependency object.
Query notifications are supported only for SELECT statements that meet a list of specific requirements. For more information, see SQL Server Service Broker and Working with Query Notifications.
Product | Versions |
---|---|
.NET | 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Creates a new instance of the SqlDependency class and associates it with the SqlCommand parameter.
public:
SqlDependency(System::Data::SqlClient::SqlCommand ^ command);
public SqlDependency(System.Data.SqlClient.SqlCommand command);
new System.Data.SqlClient.SqlDependency : System.Data.SqlClient.SqlCommand -> System.Data.SqlClient.SqlDependency
Public Sub New (command As SqlCommand)
The SqlCommand object to associate with this SqlDependency object. The constructor will set up a SqlNotificationRequest object and bind it to the command.
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.
Query notifications are supported only for SELECT statements that meet a list of specific requirements. For more information, see SQL Server Service Broker and Working with Query Notifications.
Product | Versions |
---|---|
.NET | 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Creates a new instance of the SqlDependency class, associates it with the SqlCommand parameter, and specifies notification options and a time-out value.
public:
SqlDependency(System::Data::SqlClient::SqlCommand ^ command, System::String ^ options, int timeout);
public SqlDependency(System.Data.SqlClient.SqlCommand command, string options, int timeout);
new System.Data.SqlClient.SqlDependency : System.Data.SqlClient.SqlCommand * string * int -> System.Data.SqlClient.SqlDependency
Public Sub New (command As SqlCommand, options As String, timeout As Integer)
The SqlCommand object to associate with this SqlDependency object. The constructor sets up a SqlNotificationRequest object and bind it to the command.
The notification request options to be used by this dependency. null
to use the default service.
The time-out for this notification in seconds. The default is 0, indicating that the server's time-out should be used.
The command
parameter is NULL.
The time-out value is less than zero.
The SqlCommand object already has a SqlNotificationRequest object assigned to its Notification property and that SqlNotificationRequest is not associated with this dependency.
An attempt was made to create a SqlDependency instance from within SQLCLR.
Query notifications are supported only for SELECT statements that meet a list of specific requirements. For more information, see SQL Server Service Broker and Working with Query Notifications.
Product | Versions |
---|---|
.NET | 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in