This documentation is archived and is not being maintained.

SqlCacheDependencyAdmin::EnableTableForNotifications Method (String, String)

Connects to the specified SQL Server database and enables the specified database table for SqlCacheDependency change notifications.

Namespace:  System.Web.Caching
Assembly:  System.Web (in System.Web.dll)

public:
static void EnableTableForNotifications(
	String^ connectionString, 
	String^ table
)

Parameters

connectionString
Type: System::String

A connection string used to connect to the SQL Server database.

table
Type: System::String

The database table on which to enable change notifications.

ExceptionCondition
DatabaseNotEnabledForNotificationException

The database is not enabled for change notifications.

ArgumentNullException

table is nullptr.

HttpException

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 EnableTableForNotifications method adds change notifications for the table specified in the table parameter, which must be in the database specified in the connectionString parameter.

Once you have used the EnableTableForNotifications method to add change notifications to a table, you must use one of the DisableTableForNotifications overloads if you wish to disable change notifications.

The following code example uses the EnableTableForNotifications method to enable change notifications on the specified table in the database specified in the connection string MyConnectionString.

For the full code required to run the example, see the Example section of the SqlCacheDependencyAdmin class overview topic.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Show: