SqlCacheDependencyAdmin.EnableNotifications(String) Method
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.
Enables SqlCacheDependency change notifications on the specified database.
public:
static void EnableNotifications(System::String ^ connectionString);
public static void EnableNotifications (string connectionString);
static member EnableNotifications : string -> unit
Public Shared Sub EnableNotifications (connectionString As String)
- connectionString
- String
A connection string used to connect to the SQL Server database.
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.
The following code example uses the EnableNotifications method to enable 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.
protected void enableNotification_Click(object sender, EventArgs e)
{
SqlCacheDependencyAdmin.EnableNotifications(
ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
}
Protected Sub enableNotification_Click(ByVal sender As Object, ByVal e As System.EventArgs)
SqlCacheDependencyAdmin.EnableNotifications( _
ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
End Sub
The EnableNotifications method adds support for change notifications from the database specified in the connectionString
parameter. Once you have run the EnableNotifications method, you must run the DisableNotifications method if you wish to disable change notifications for a database.
Producto | Versiones |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: