Modifica

Condividi tramite


SqlDependency Constructors

Definition

Creates a new instance of the SqlDependency class.

Overloads

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.

SqlDependency()

Source:
System.Data.SqlClient.notsupported.cs

Creates a new instance of the SqlDependency class with the default settings.

public:
 SqlDependency();
public SqlDependency ();
Public Sub New ()

Remarks

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.

See also

Applies to

SqlDependency(SqlCommand)

Source:
System.Data.SqlClient.notsupported.cs

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)

Parameters

command
SqlCommand

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

Exceptions

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.

Remarks

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.

See also

Applies to

SqlDependency(SqlCommand, String, Int32)

Source:
System.Data.SqlClient.notsupported.cs

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)

Parameters

command
SqlCommand

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

options
String

The notification request options to be used by this dependency. null to use the default service.

timeout
Int32

The time-out for this notification in seconds. The default is 0, indicating that the server's time-out should be used.

Exceptions

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.

Remarks

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.

See also

Applies to