SubscriptionEventRule.Parent Property

Gets or sets the parent SubscriptionClass object for the event rule.

命名空間: Microsoft.SqlServer.Management.Nmo
組件: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

語法

'宣告
Public Property Parent As SubscriptionClass
public SubscriptionClass Parent { get; set; }
public:
property SubscriptionClass^ Parent {
    SubscriptionClass^ get ();
    void set (SubscriptionClass^ value);
}
/** @property */
public SubscriptionClass get_Parent ()

/** @property */
public void set_Parent (SubscriptionClass value)
public function get Parent () : SubscriptionClass

public function set Parent (value : SubscriptionClass)

屬性值

The parent SubscriptionClass object.

備註

更新的文字:2005 年 12 月 5 日

更新的範例程式碼:2005 年 12 月 5 日

Each SubscriptionEventRule has a parent SubscriptionClass. You typically supply the parent object when you create the SubscriptionEventRule using the SubscriptionEventRule(SubscriptionClass,String) constructor.

If you set the parent in the constructor, do not set the parent using this property. Setting the parent twice throws an exception.

範例

The following examples show how to set the Parent property when using the default constructor:

// 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)

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

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

其他資源

定義事件規則
SubscriptionClass Element (ADF)