Share via


SubscriptionConditionEventRule.SqlLoginName Property

Gets or sets the Microsoft SQL Server login account that Notification Services uses to create the database user that runs the statements specified in the SqlExpression property.

Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntaxe

'Déclaration
Public Property SqlLoginName As String
public string SqlLoginName { get; set; }
public:
property String^ SqlLoginName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_SqlLoginName ()

/** @property */
public void set_SqlLoginName (String value)
public function get SqlLoginName () : String

public function set SqlLoginName (value : String)

Valeur de propriété

A String that specifies the name of a SQL Server login.

Notes

All SubscriptionConditionEventRule rules execute in the context of a database user that you specify. Using a low-privileged user minimizes the security threat in case anyone compromises your subscription management interface and inserts conditions that attempt to access other tables or perform other actions.

You specify the database user using the SqlUserName property. You specify the login account that is associated with the user using SqlLoginName property. The login must exist before Notification Services creates the application. If the login does not exist, Notification Services fails when attempting to create the application and rolls back the instance creation or instance update. Make sure the login will continue to exist while the application is deployed.

The login can be either a Windows Authentication login or a SQL Server Authentication login. The login is used within the Database Engine instance to run rule logic.

Exemple

The following example shows how to define a condition-based, event-driven subscription rule and add it to a subscription class:

// Add a rule to generate condition-based, event notifications
SubscriptionConditionEventRule flightConditionEventRule = 
    new SubscriptionConditionEventRule(
    flightSubscriptions, "FlightConditionEventRule");
flightConditionEventRule.EventClassName = "FlightEvents";
flightConditionEventRule.ActionTimeout = new TimeSpan(0, 2, 0);
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin";
flightConditionEventRule.SqlUserName = "MyLowPrivUser";
flightConditionEventRule.InputTypeName = "FlightEvents";
flightConditionEventRule.InputTypeSchema = "MyAppSchema";
flightConditionEventRule.SqlExpression =
    "INSERT INTO MyAppSchema.FlightNotifications (SubscriberId, " +
    "DeviceName, SubscriberLocale, LeavingFrom, GoingTo, Price) " +
    "SELECT [Subscription.SubscriberId], [Subscription.DeviceName], " +
    "[Subscription.SubscriberLocale], " +
    "[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " +
    "FROM MyAppSchema.FlightConditionEventRule;";
flightSubscriptions.SubscriptionConditionEventRules.Add(
    flightConditionEventRule);
' Add a rule to generate condition-based, event notifications
Dim flightConditionEventRule As _
    SubscriptionConditionEventRule = _
    New SubscriptionConditionEventRule( _
    flightSubscriptions, "FlightConditionEventRule")
flightConditionEventRule.EventClassName = "FlightEvents"
flightConditionEventRule.ActionTimeout = New TimeSpan(0, 2, 0)
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin"
flightConditionEventRule.SqlUserName = "MyLowPrivUser"
flightConditionEventRule.InputTypeName = "FlightEvents"
flightConditionEventRule.InputTypeSchema = "MyAppSchema"
flightConditionEventRule.SqlExpression = _
 "INSERT INTO MyAppSchema.FlightNotifications " + _
 "(SubscriberId, DeviceName, SubscriberLocale, LeavingFrom, " + _
 "GoingTo, Price) SELECT [Subscription.SubscriberId], " + _
 "[Subscription.DeviceName], [Subscription.SubscriberLocale], " + _
 "[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " + _
 "FROM MyAppSchema.FlightConditionEventRule;"
flightSubscriptions.SubscriptionConditionEventRules.Add( _
    flightConditionEventRule)

Sécurité des threads

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.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

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

Autres ressources

SqlLogin Element (ADF)
Définition de règles d'événement
Définition des actions de condition
EventRule Element (ADF)
ConditionAction Element (ADF)