次の方法で共有


SubscriptionEventRule Constructor ()

SubscriptionEventRule クラスの新しいインスタンスを初期化します。

名前空間: Microsoft.SqlServer.Management.Nmo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)

構文

'宣言
Public Sub New
public SubscriptionEventRule ()
public:
SubscriptionEventRule ()
public SubscriptionEventRule ()
public function SubscriptionEventRule ()

解説

更新されたテキスト :2005 年 12 月 5 日

更新されたサンプル コード :2005 年 12 月 5 日

既定のコンストラクタを使用する場合は、最初に Name を設定してから Parent を設定し、その後でその他のプロパティを設定してランタイム例外を回避します。このコンストラクタでは、いずれのプロパティ値も設定されません。

使用例

次の例は、この既定のコンストラクタを使用してイベント ドリブン ルールを作成し、ルールをサブスクリプション クラスに追加する方法を示しています。

// Create an event rule and set properties.
SubscriptionEventRule flightEventRule = new SubscriptionEventRule();
flightEventRule.Name = "FlightSubscriptionsEventRule";
flightEventRule.Parent = flightSubscriptions;
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, 30, 0);
flightEventRule.EventClassName = "FlightEvents";
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule);
' Create an event rule and set properties.
Dim flightEventRule As SubscriptionEventRule = _
    New SubscriptionEventRule()
flightEventRule.Name = "FlightSubscriptionsEventRule"
flightEventRule.Parent = flightSubscriptions
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, 30, 0)
flightEventRule.EventClassName = "FlightEvents"
flightSubscriptions.SubscriptionEventRules.Add(flightEventRule)

プラットフォーム

開発プラットフォーム

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

対象プラットフォーム

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

参照

関連項目

SubscriptionEventRule Class
SubscriptionEventRule Members
Microsoft.SqlServer.Management.Nmo Namespace