SqlCacheDependencyAdmin.DisableTableForNotifications 方法

定义

禁用 SQL Server 数据库表或数据库表数组的 SqlCacheDependency 更改通知。Disables SqlCacheDependency change notifications on a SQL Server database table or an array of database tables.

重载

DisableTableForNotifications(String, String)

禁用 SQL Server 数据库表的 SqlCacheDependency 更改通知。Disables SqlCacheDependency change notifications on a SQL Server database table.

DisableTableForNotifications(String, String[])

禁用 SQL Server 数据库表的数组的 SqlCacheDependency 更改通知。Disables SqlCacheDependency change notifications on an array of SQL Server database tables.

DisableTableForNotifications(String, String)

禁用 SQL Server 数据库表的 SqlCacheDependency 更改通知。Disables SqlCacheDependency change notifications on a SQL Server database table.

public:
 static void DisableTableForNotifications(System::String ^ connectionString, System::String ^ table);
public static void DisableTableForNotifications (string connectionString, string table);
static member DisableTableForNotifications : string * string -> unit
Public Shared Sub DisableTableForNotifications (connectionString As String, table As String)

参数

connectionString
String

用于与 SQL Server 数据库建立连接的连接字符串。A connection string used to connect to the SQL Server database.

table
String

要禁用其更改通知的数据库表。The database table on which to disable change notifications.

例外

没有为更改通知启用数据库。The database is not enabled for change notifications.

table 为空字符串 ("")。table is an empty string ("").

tablenulltable is null.

未能建立与数据库的连接。A connection to the database could not be established.

- 或 --or-

ASP.NET 应用程序的安全性上下文没有连接到数据库的权限。The security context of the ASP.NET application does not have permission to connect to the database.

- 或 --or-

ASP.NET 应用程序的安全性上下文没有禁用数据库通知的权限。The security context of the ASP.NET application does not have permission to disable notifications for the database.

示例

下面的代码示例将禁用在连接字符串中指定的表的更改通知 MyConnectionStringThe following code example disables change notification on a table specified in the connection string MyConnectionString.

有关运行此示例所需的完整代码,请参阅类概述主题的 "示例" 部分 SqlCacheDependencyAdminFor the full code required to run the example, see the Example section of the SqlCacheDependencyAdmin class overview topic.

SqlCacheDependencyAdmin.EnableTableForNotifications(
  ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString,
  tableName.Text);
SqlCacheDependencyAdmin.EnableTableForNotifications( _
  ConfigurationManager.ConnectionStrings("MyConnectionString").ConnectionString, _
  tableName.Text)

注解

DisableTableForNotifications方法为参数中指定的表禁用更改通知 table ,参数中必须有指定的数据库 connectionStringThe DisableTableForNotifications method disables change notifications for the table specified in the table parameter, which must be in the database specified in the connectionString parameter.

使用 DisableTableForNotifications 方法禁用表的更改通知后, EnableTableForNotifications 如果想要重新启用更改通知,则必须使用重载之一。Once you have used the DisableTableForNotifications method to disable change notifications for a table, you must use one of the EnableTableForNotifications overloads if you wish to re-enable change notifications.

适用于

DisableTableForNotifications(String, String[])

禁用 SQL Server 数据库表的数组的 SqlCacheDependency 更改通知。Disables SqlCacheDependency change notifications on an array of SQL Server database tables.

public:
 static void DisableTableForNotifications(System::String ^ connectionString, cli::array <System::String ^> ^ tables);
public static void DisableTableForNotifications (string connectionString, string[] tables);
static member DisableTableForNotifications : string * string[] -> unit
Public Shared Sub DisableTableForNotifications (connectionString As String, tables As String())

参数

connectionString
String

用于与 SQL Server 数据库建立连接的连接字符串。A connection string used to connect to the SQL Server database.

tables
String[]

要禁用其更改通知的 SQL Server 数据库表的数组。The array of SQL Server database tables on which to disable change notifications.

例外

没有为更改通知启用数据库。The database is not enabled for change notifications.

tables 参数中的一个值为 nullOne of the values in the tables parameter is null.

- 或 --or-

tables 参数中的一个值为空字符串 ("")。One of the values in the tables parameter is an empty string ("").

tablesnulltables is null.

未能建立与数据库的连接。A connection to the database could not be established.

- 或 --or-

ASP.NET 应用程序的安全性上下文没有连接到数据库的权限。The security context of the ASP.NET application does not have permission to connect to the database.

- 或 --or-

ASP.NET 应用程序的安全性上下文没有禁用数据库通知的权限。The security context of the ASP.NET application does not have permission to disable notifications for the database.

注解

DisableTableForNotifications方法从参数中指定的表中删除更改通知 tablesThe DisableTableForNotifications method removes change notifications from the tables specified in the tables parameter. 这些表必须位于参数中指定的数据库中 connectionStringThese tables must be in the database specified in the connectionString parameter.

使用 DisableTableForNotifications 方法禁用表列表的更改通知后, EnableTableForNotifications 如果想要重新启用更改通知,则必须使用重载之一。Once you have used the DisableTableForNotifications method to disable change notifications for a list of tables, you must use one of the EnableTableForNotifications overloads if you wish to re-enable change notifications.

适用于