Share via


SqlCacheDependencyAdmin.DisableNotifications(String) メソッド

定義

指定されているデータベースの SqlCacheDependency 変更通知を無効にします。

public:
 static void DisableNotifications(System::String ^ connectionString);
public static void DisableNotifications (string connectionString);
static member DisableNotifications : string -> unit
Public Shared Sub DisableNotifications (connectionString As String)

パラメーター

connectionString
String

SQL Server データベースに接続するときに使用する接続文字列。

例外

データベースへの接続を確立できませんでした。

- または -

ASP.NET アプリケーションのセキュリティ コンテキストに、データベースに接続できる権限がありません。

- または -

ASP.NET アプリケーションのセキュリティ コンテキストに、データベースの通知を無効にできる権限がありません。

次のコード例では、 メソッドを DisableNotifications 使用して、接続文字列 MyConnectionStringで指定されたデータベースの変更通知を無効にします。

この例を実行するために必要な完全なコードについては、クラスの概要に関するトピックの「例」セクションを SqlCacheDependencyAdmin 参照してください。

' Create a method to disable SqlCacheDependency
' change notifications for the Northwind database.
Public Sub DisableDatabase_Click( _
 sender As Object, e As System.EventArgs)

   SqlCacheDependencyAdmin.DisableNotifications( _
   "Northwind")
   Response.Write("Northwind database disabled at " _
   & DateTime.Now.ToString())

   ' An HttpException is thrown if adequate permissions to
   ' modify the database are not granted.

End Sub

注釈

メソッドは DisableNotifications 、 パラメーターで指定されたデータベースから変更通知のサポートを connectionString 削除します。 メソッドを実行したら、データベースの DisableNotifications 変更通知を EnableNotifications 再度有効にする場合は、 メソッドを実行する必要があります。

適用対象