SqlDependency.Stop 方法

定義

停止在前一個 Start 呼叫中指定之連接的接聽程式。

多載

Stop(String)

停止在前一個 Start 呼叫中指定之連接的接聽程式。

Stop(String, String)

停止在前一個 Start 呼叫中指定之連接的接聽程式。

備註

當 SQL Server 連線發生錯誤時,接SqlDependency聽程式將會重新啟動。

Stop(String)

停止在前一個 Start 呼叫中指定之連接的接聽程式。

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

參數

connectionString
String

連接字串,其指定前一個 Start(String) 呼叫中所使用的 SQL Server 執行個體。

傳回

如果接聽程式已完全停止,則為 true;如果有 AppDomain 從接聽程式解除繫結,但至少有另一個 AppDomain 正在使用相同接聽程式時,則為 false

例外狀況

connectionString 參數為 NULL。

方法從 SQLCLR 中呼叫。

呼叫端沒有必要的 SqlClientPermission 程式碼存取安全性 (CAS) 使用權限。

發生基礎 SqlClient 例外狀況。

備註

Stop每個呼叫都必須呼叫 Start 方法。 指定的接聽程式只會在收到與要求相同的要求Start數目Stop時完全關閉。

另請參閱

適用於

Stop(String, String)

停止在前一個 Start 呼叫中指定之連接的接聽程式。

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

參數

connectionString
String

連接字串,其指定前一個 Start(String, String) 呼叫中所使用的 SQL Server 執行個體。

queue
String

在前一個 Start(String, String) 呼叫中所使用的 SQL Server Service Broker 佇列。

傳回

如果接聽程式已完全停止,則為 true;如果有 AppDomain 從接聽程式解除繫結,但至少有另一個 AppDomain 正在使用相同接聽程式時,則為 false

例外狀況

connectionString 參數為 NULL。

方法從 SQLCLR 中呼叫。

呼叫端沒有必要的 SqlClientPermission 程式碼存取安全性 (CAS) 使用權限。

且發生基礎 SqlClient 例外狀況。

備註

Stop每個呼叫都必須呼叫 Start 方法。 指定的接聽程式只會在收到與要求相同的要求Start數目Stop時完全關閉。

另請參閱

適用於