SqlCacheDependencyAdmin.EnableTableForNotifications 메서드

정의

SQL Server 데이터베이스에 연결하고 SqlCacheDependency 변경 알림에 대한 데이터베이스 테이블 또는 테이블을 준비합니다.

오버로드

Name Description
EnableTableForNotifications(String, String)

지정된 SQL Server 데이터베이스에 연결하고 SqlCacheDependency 변경 알림에 대해 지정된 데이터베이스 테이블을 사용하도록 설정합니다.

EnableTableForNotifications(String, String[])

지정된 SQL Server 데이터베이스에 연결하고 SqlCacheDependency 변경 알림에 대해 지정된 데이터베이스 테이블 배열을 사용하도록 설정합니다.

EnableTableForNotifications(String, String)

지정된 SQL Server 데이터베이스에 연결하고 SqlCacheDependency 변경 알림에 대해 지정된 데이터베이스 테이블을 사용하도록 설정합니다.

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

매개 변수

connectionString
String

SQL Server 데이터베이스에 연결하는 데 사용되는 연결 문자열.

table
String

변경 알림을 사용하도록 설정할 데이터베이스 테이블입니다.

예외

변경 알림에 데이터베이스를 사용할 수 없습니다.

tablenull입니다.

데이터베이스에 대한 연결을 설정할 수 없습니다.

-또는-

ASP.NET 애플리케이션의 보안 컨텍스트에는 데이터베이스에 연결할 수 있는 권한이 없습니다.

-또는-

ASP.NET 애플리케이션의 보안 컨텍스트에는 데이터베이스에 대한 알림을 사용하지 않도록 설정할 수 있는 권한이 없습니다.

예제

다음 코드 예제에서는 EnableTableForNotifications 메서드를 사용하여 연결 문자열 MyConnectionString 지정한 데이터베이스의 지정된 테이블에서 변경 알림을 사용하도록 설정합니다.

예제를 실행하는 데 필요한 전체 코드는 클래스 개요 항목의 예제 섹션을 SqlCacheDependencyAdmin 참조하세요.

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

설명

이 메서드는 EnableTableForNotifications 매개 변수에 table 지정된 테이블에 대한 변경 알림을 추가합니다. 이 알림은 매개 변수에 지정된 데이터베이스에 connectionString 있어야 합니다.

이 메서드를 EnableTableForNotifications 사용하여 테이블에 변경 알림을 추가한 후에는 변경 알림을 사용하지 않도록 설정하려는 경우 오버로드 중 DisableTableForNotifications 하나를 사용해야 합니다.

적용 대상

EnableTableForNotifications(String, String[])

지정된 SQL Server 데이터베이스에 연결하고 SqlCacheDependency 변경 알림에 대해 지정된 데이터베이스 테이블 배열을 사용하도록 설정합니다.

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

매개 변수

connectionString
String

SQL Server 데이터베이스에 연결하는 데 사용되는 연결 문자열.

tables
String[]

변경 알림을 사용하도록 설정할 SQL Server 데이터베이스 테이블의 배열입니다.

예외

변경 알림에 데이터베이스를 사용할 수 없습니다.

매개 변수의 값 tables 중 하나는 .입니다 null.

-또는-

매개 변수의 값 tables 중 하나는 빈 문자열("")입니다.

tablesnull입니다.

데이터베이스에 대한 연결을 설정할 수 없습니다.

-또는-

ASP.NET 애플리케이션의 보안 컨텍스트에는 데이터베이스에 연결할 수 있는 권한이 없습니다.

-또는-

ASP.NET 애플리케이션의 보안 컨텍스트에는 데이터베이스에 대한 알림을 사용하지 않도록 설정할 수 있는 권한이 없습니다.

예제

다음 코드 예제에서는 EnableTableForNotifications 메서드를 사용하여 연결 문자열 MyConnectionString 지정된 데이터베이스의 세미콜론으로 구분된 목록에 지정된 테이블에서 변경 알림을 사용하도록 설정합니다.

예제를 실행하는 데 필요한 전체 코드는 클래스 개요 항목의 예제 섹션을 SqlCacheDependencyAdmin 참조하세요.

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

설명

메서드는 EnableTableForNotifications 매개 변수에 지정된 tables 테이블에 대한 변경 알림을 추가합니다. 이러한 테이블은 매개 변수에 지정된 데이터베이스에 connectionString 있어야 합니다.

이 메서드를 EnableTableForNotifications 사용하여 테이블 그룹에 변경 알림을 추가한 후에는 변경 알림을 사용하지 않도록 설정하려면 오버로드 중 DisableTableForNotifications 하나를 사용해야 합니다.

적용 대상