SqlCacheDependencyAdmin.DisableNotifications(String) Method
Definition
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.
Disables SqlCacheDependency change notifications for the specified database.
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)
Parameters
- connectionString
- String
A connection string used to connect to the SQL Server database.
Exceptions
A connection to the database could not be established.
-or-
The security context of the ASP.NET application does not have permission to connect to the database.
-or-
The security context of the ASP.NET application does not have permission to disable notifications for the database.
Examples
The following code example uses the DisableNotifications method to disable change notifications for the database specified by the connection string MyConnectionString
.
For the full code required to run the example, see the Example section of the SqlCacheDependencyAdmin class overview topic.
' 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
Remarks
The DisableNotifications method removes support for change notifications from the database specified in the connectionString
parameter. Once you have run the DisableNotifications method, you must run the EnableNotifications method if you wish to re-enable change notifications for a database.