次の方法で共有


Subscription.Add Method

アプリケーション データベースにサブスクリプション レコードを追加します。

名前空間: Microsoft.SqlServer.NotificationServices
アセンブリ: Microsoft.SqlServer.NotificationServices (microsoft.sqlserver.notificationservices.dll 内)

構文

'宣言
Public Function Add As String
public string Add ()
public:
virtual String^ Add () sealed
public final String Add ()
public final function Add () : String

戻り値

新しいサブスクリプションのサブスクリプション ID を表す文字列です。

解説

新しいサブスクリプションをデータベースに追加すると、Notification Services がこのサブスクリプションに一意のサブスクリプション ID を割り当てます。Notification Services のコンポーネントは、このサブスクリプション ID を使用してサブスクリプションを特定します。

使用例

Add メソッドを使用してサブスクリプションを追加する例を次に示します。

' Create the NSInstance object.
Dim testInstance As New NSInstance("Tutorial")
 
' Create the NSApplication object.
Dim testApplication As New NSApplication(testInstance, "Weather")
 
' Create the Subscription object.
Dim testSubscription As _
    New Subscription(testApplication, "WeatherCity")
 
 
' Set the properties that describe the subscription record.
testSubscription.Enabled = True
testSubscription.SubscriberId = "TestUser1"
 
' Set the subscription data fields (as defined in the ADF),
' using the indexer to set fields by field name.
testSubscription("DeviceName") = "Work e-mail"
testSubscription("SubscriberLocale") = "en-US"
testSubscription("City") = "Shoreline"
 
' Add the subscription to the database.
testSubscription.Add()
// Create the NSInstance object.
NSInstance testInstance = new NSInstance("Tutorial");

// Create the NSApplication object.
NSApplication testApplication =
    new NSApplication(testInstance, "Weather");

// Create the Subscription object.
Subscription testSubscription =
    new Subscription(testApplication, "WeatherCity");


// Set the properties that describe the subscription record.
testSubscription.Enabled = true;
testSubscription.SubscriberId = "TestUser1";

// Set the subscription data fields (as defined in the ADF),
// using the indexer to set fields by field name.
testSubscription["DeviceName"] = "Work e-mail";
testSubscription["SubscriberLocale"] = "en-US";
testSubscription["City"] = "Shoreline";

// Add the subscription to the database.
testSubscription.Add();

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

Subscription Class
Subscription Members
Microsoft.SqlServer.NotificationServices Namespace