SqlCacheDependencyAdmin.EnableTableForNotifications Method (String, String[])

Connects to the specified SQL Server database and enables the specified array of database tables for SqlCacheDependency change notification.

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

public:
static void EnableTableForNotifications (
	String^ connectionString, 
	array<String^>^ tables
)
public static void EnableTableForNotifications (
	String connectionString, 
	String[] tables
)
public static function EnableTableForNotifications (
	connectionString : String, 
	tables : String[]
)
Not applicable.

Parameters

connectionString

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

tables

The array of SQL Server database tables on which to enable change notifications.

Exception typeCondition

DatabaseNotEnabledForNotificationException

The database is not enabled for change notifications.

ArgumentException

One of the values in the tables parameter is a null reference (Nothing in Visual Basic).

-or-

One of the values in the tables parameter is an empty string ("").

ArgumentNullException

tables is a null reference (Nothing in Visual Basic).

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 tables specified in the tables parameter. These tables must be in the database specified in the connectionString parameter.

Once you have used the EnableTableForNotifications method to add change notifications to a group of tables, 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 tables specified in a semicolon-delimited list 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 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: