SimpleLeafCondition Constructor (Argument, SimpleOperator, Argument)
Initializes a new instance of the SimpleLeafCondition class with two arguments objects and an operator.
命名空间: Microsoft.SqlServer.NotificationServices.Rules
程序集: Microsoft.SqlServer.NotificationServices.Rules (in microsoft.sqlserver.notificationservices.rules.dll)
语法
声明
Public Sub New ( _
left As Argument, _
op As SimpleOperator, _
right As Argument _
)
public SimpleLeafCondition (
Argument left,
SimpleOperator op,
Argument right
)
public:
SimpleLeafCondition (
Argument^ left,
SimpleOperator op,
Argument^ right
)
public SimpleLeafCondition (
Argument left,
SimpleOperator op,
Argument right
)
public function SimpleLeafCondition (
left : Argument,
op : SimpleOperator,
right : Argument
)
参数
- op
Sets the SimpleOperator for the Operator property.
- right
The Argument for the Right property.
示例
The following examples show how to use a SimpleLeafCondition to define the conditions that need to be met by an event in order for Notification Services to generate a notification for the subscriber:
// Create the NSInstance object.
NSInstance testInstance =
new NSInstance("InventoryTrackerInstance");
// Create the NSApplication object.
NSApplication testApplication =
new NSApplication(testInstance, "InventoryTracker");
// Create Subscription object.
Subscription s = new Subscription(testApplication,
"InventoryTrackerSubscriptions");
// Define subscription properties
s.SubscriberId = "TestUser1";
s.Enabled = true;
s.RuleName = "InventoryTrackerRule";
s["DeviceName"] = "Work e-mail";
s["SubscriberLocale"] = "en-US";
// Define OrCondition
s.Condition = new AndCondition(
new SimpleLeafCondition(new FieldValue("ProductName"),
SimpleOperator.Equals,
"Road-250 Black, 48"),
new SimpleLeafCondition(new FieldValue("LocationName"),
SimpleOperator.Equals,
"Final Assembly"),
new SimpleLeafCondition(new FieldValue("Quantity"),
SimpleOperator.LessThanOrEqualTo,
35)
);
// Add subscription
s.Add();
' Create the NSInstance object.
Dim testInstance As New NSInstance("InventoryTrackerInstance")
' Create the NSApplication object.
Dim testApplication As _
New NSApplication(testInstance, "InventoryTracker")
' Create Subscription object.
Dim s As New Subscription(testApplication, _
"InventoryTrackerSubscriptions")
' Define subscription properties
s.SubscriberId = "TestUser1"
s.Enabled = True
s.RuleName = "InventoryTrackerRule"
s("DeviceName") = "Work e-mail"
s("SubscriberLocale") = "en-US"
' Define OrCondition
s.Condition = New AndCondition( _
New SimpleLeafCondition( _
New FieldValue("ProductName"), _
SimpleOperator.Equals, _
"Road-250 Black, 48"), _
New SimpleLeafCondition( _
New FieldValue("LocationName"), _
SimpleOperator.Equals, _
"Final Assembly"), _
New SimpleLeafCondition( _
New FieldValue("Quantity"), _
SimpleOperator.LessThanOrEqualTo, _
35))
' Add subscription
s.Add()
平台
开发平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
目标平台
有关支持的平台列表,请参阅安装 SQL Server 2005 的硬件和软件要求。
请参阅
参考
SimpleLeafCondition Class
SimpleLeafCondition Members
Microsoft.SqlServer.NotificationServices.Rules Namespace