SqlDependency.Stop Method

Definition

Stops a listener for a connection specified in a previous Start call.

Overloads

Stop(String)

Stops a listener for a connection specified in a previous Start call.

Stop(String, String)

Stops a listener for a connection specified in a previous Start call.

Remarks

The SqlDependency listener will restart when an error occurs in the SQL Server connection.

Stop(String)

Stops a listener for a connection specified in a previous Start call.

public:
 static bool Stop(System::String ^ connectionString);
public static bool Stop (string connectionString);
static member Stop : string -> bool
Public Shared Function Stop (connectionString As String) As Boolean

Parameters

connectionString
String

Connection string for the instance of SQL Server that was used in a previous Start(String) call.

Returns

true if the listener was completely stopped; false if the AppDomain was unbound from the listener, but there are is at least one other AppDomain using the same listener.

Exceptions

The connectionString parameter is NULL.

The method was called from within SQLCLR.

The caller does not have the required SqlClientPermission code access security (CAS) permission.

An underlying SqlClient exception occurred.

Remarks

The Stop method must be called for each Start call. A given listener only shuts down fully when it receives the same number of Stop requests as Start requests.

See also

Applies to

Stop(String, String)

Stops a listener for a connection specified in a previous Start call.

public:
 static bool Stop(System::String ^ connectionString, System::String ^ queue);
public static bool Stop (string connectionString, string queue);
static member Stop : string * string -> bool
Public Shared Function Stop (connectionString As String, queue As String) As Boolean

Parameters

connectionString
String

Connection string for the instance of SQL Server that was used in a previous Start(String, String) call.

queue
String

The SQL Server Service Broker queue that was used in a previous Start(String, String) call.

Returns

true if the listener was completely stopped; false if the AppDomain was unbound from the listener, but there is at least one other AppDomain using the same listener.

Exceptions

The connectionString parameter is NULL.

The method was called from within SQLCLR.

The caller does not have the required SqlClientPermission code access security (CAS) permission.

And underlying SqlClient exception occurred.

Remarks

The Stop method must be called for each Start call. A given listener only shuts down fully when it receives the same number of Stop requests as Start requests.

See also

Applies to