SqlCacheDependencyAdmin.GetTablesEnabledForNotifications(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.
Retrieves a string array containing the name of every table that is enabled for change notifications in a SQL Server database.
public:
static cli::array <System::String ^> ^ GetTablesEnabledForNotifications(System::String ^ connectionString);
public static string[] GetTablesEnabledForNotifications (string connectionString);
static member GetTablesEnabledForNotifications : string -> string[]
Public Shared Function GetTablesEnabledForNotifications (connectionString As String) As String()
Parameters
- connectionString
- String
A connection string used to connect to the SQL Server database.
Returns
A string array that contains the names of the SQL Server database tables.
Exceptions
The database is not enabled for change notifications.
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 creates a string array of the tables enabled for change notifications 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.
string[] enabledTablesList =
SqlCacheDependencyAdmin.GetTablesEnabledForNotifications(
ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
Dim enabledTablesList As String()
enabledTablesList = SqlCacheDependencyAdmin.GetTablesEnabledForNotifications( _
ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString)
Remarks
The GetTablesEnabledForNotifications method returns a string array containing the names of all tables in the database specified in the connectionString
parameter that are enabled for change notifications.