SubscriptionEventRuleCollection.Add Method
SubscriptionEventRule を SubscriptionEventRuleCollection に追加します。
名前空間: Microsoft.SqlServer.Management.Nmo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)
構文
'宣言
Public Sub Add ( _
subscriptionEventRule As SubscriptionEventRule _
)
public void Add (
SubscriptionEventRule subscriptionEventRule
)
public:
void Add (
SubscriptionEventRule^ subscriptionEventRule
)
public void Add (
SubscriptionEventRule subscriptionEventRule
)
public function Add (
subscriptionEventRule : SubscriptionEventRule
)
パラメータ
- subscriptionEventRule
コレクションに追加する SubscriptionEventRule です。
解説
アプリケーションを配置した後にルールを追加した場合は、インスタンスに対して Update を実行して変更を適用する必要があります。
使用例
次の例は、イベント ルールを定義してサブスクリプション クラスに追加する方法を示しています。
// Add a rule to generate basic event-triggered notifications
SubscriptionEventRule flightEventRule =
new SubscriptionEventRule(flightSubscriptions,
"FlightSubscriptionsEventRule");
flightEventRule.Action = "INSERT INTO FlightNotifications " +
"(SubscriberId, DeviceName, SubscriberLocale, " +
"LeavingFrom, GoingTo, Price) " +
"SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " +
"E.LeavingFrom, E.GoingTo, E.Price " +
"FROM FlightEvents E, FlightSubscriptions S " +
"WHERE E.LeavingFrom = S.LeavingFrom " +
"AND E.GoingTo = S.GoingTo " +
"AND E.Price < S.Price";
flightEventRule.ActionTimeout = new TimeSpan(0, 1, 0);
flightEventRule.EventClassName = "FlightEvents";
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule);
' Add a rule to generate basic event-triggered notifications
Dim flightEventRule As SubscriptionEventRule = _
New SubscriptionEventRule(flightSubscriptions, _
"FlightSubscriptionsEventRule")
flightEventRule.Action = _
"INSERT INTO FlightNotifications " + _
"(SubscriberId, DeviceName, SubscriberLocale, " + _
"LeavingFrom, GoingTo, Price) " + _
"SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " + _
"E.LeavingFrom, E.GoingTo, E.Price " + _
"FROM FlightEvents E, FlightSubscriptions S " + _
"WHERE E.LeavingFrom = S.LeavingFrom " + _
"AND E.GoingTo = S.GoingTo " + _
"AND E.Price < S.Price"
flightEventRule.ActionTimeout = New TimeSpan(0, 1, 0)
flightEventRule.EventClassName = "FlightEvents"
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule)
スレッド セーフ
この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォーム
開発プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
対象プラットフォーム
サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。
参照
関連項目
SubscriptionEventRuleCollection Class
SubscriptionEventRuleCollection Members
Microsoft.SqlServer.Management.Nmo Namespace