다음을 통해 공유


구독자 장치 삭제

SubscriberDevice 클래스의 Delete 메서드는 Notification Services 데이터베이스에서 기존의 구독자 장치 레코드를 삭제합니다. 아래 예에서는 구독자 장치를 삭제하기 위해 관리 코드를 사용하는 방법과 COM interop을 나타내는 Microsoft VBScript(Visual Basic Scripting Edition)를 사용하는 방법을 보여 줍니다.

마지막 구독자 장치를 삭제하면 Notification Services는 구독자 장치 테이블에서 구독자에 대한 행을 남겨 두지만 해당 속성을 모두 NULL로 설정합니다.

관리 코드 예

다음 코드 예에서는 관리 코드에서 SubscriberDevice 개체를 사용하여 구독자 장치를 삭제하는 방법을 보여 줍니다.

string instanceName = "Tutorial";

// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);

// Create the SubscriberDevice object.
SubscriberDevice testSubscriberDevice =
    new SubscriberDevice(testInstance);

// Set the subscriber ID and device name
// so that the correct record is deleted.
testSubscriberDevice.SubscriberId = "TestUser1";
testSubscriberDevice.DeviceName = "Work E-mail";

// Delete the device
testSubscriberDevice.Delete();

COM Interop 예

다음 VBScript 예에서는 비관리 코드에서 SubscriberDevice 개체를 사용하여 구독자 장치를 삭제하는 방법을 보여 줍니다.

Dim testInstance, testSubscriberDevice

const instanceName = "Tutorial"

' Create the NSInstance object.
set testInstance = _
    WScript.CreateObject( _
    "Microsoft.SqlServer.NotificationServices.NSInstance")
testInstance.Initialize instanceName

' Create the SubscriberDevice object.
set testSubscriberDevice = _
    WScript.CreateObject( _
    "Microsoft.SqlServer.NotificationServices.SubscriberDevice")
testSubscriberDevice.Initialize (testInstance)

' Set the subscriber ID and device name
' so that the correct record is deleted.
testSubscriberDevice.SubscriberId = "TestUser2"
testSubscriberDevice.DeviceName = "Work e-mail"

' Delete the device
testSubscriberDevice.Delete()

wscript.echo "Subscriber device deleted."

참고 항목

개념

SubscriberDevice 개체 만들기
구독자 장치 추가
구독자 장치 업데이트
배달 채널 목록 채우기

관련 자료

NSSubscriberDeviceView

도움말 및 정보

SQL Server 2005 지원 받기