Share via


Méthode ConnectionSettings.ThrowIfPropertyNotSet (String, String, Boolean)

Lève une exception si la propriété de connexion spécifiée a la valeur Null ou, éventuellement, est vide.

Espace de noms :  Microsoft.SqlServer.Management.Common
Assembly :  Microsoft.SqlServer.ConnectionInfo (en Microsoft.SqlServer.ConnectionInfo.dll)

Syntaxe

'Déclaration
Protected Function ThrowIfPropertyNotSet ( _
    propertyName As String, _
    str As String, _
    checkEmpty As Boolean _
) As String
'Utilisation
Dim propertyName As String 
Dim str As String 
Dim checkEmpty As Boolean 
Dim returnValue As String 

returnValue = Me.ThrowIfPropertyNotSet(propertyName, _
    str, checkEmpty)
protected string ThrowIfPropertyNotSet(
    string propertyName,
    string str,
    bool checkEmpty
)
protected:
String^ ThrowIfPropertyNotSet(
    String^ propertyName, 
    String^ str, 
    bool checkEmpty
)
member ThrowIfPropertyNotSet : 
        propertyName:string * 
        str:string * 
        checkEmpty:bool -> string
protected function ThrowIfPropertyNotSet(
    propertyName : String, 
    str : String, 
    checkEmpty : boolean
) : String

Paramètres

  • propertyName
    Type : String
    Chaîne qui spécifie le nom de la propriété de connexion, par exemple « Connexion ».
  • str
    Type : String
    Objet String qui contient la valeur de propriété.
  • checkEmpty
    Type : Boolean
    True pour rechercher une chaîne vide ou une valeur Null pour la valeur de propriété ; False pour rechercher uniquement une valeur Null.

Valeur de retour

Type : String
Si la propriété n'est pas définie, cette méthode lève un PropertyNotSetException.Sinon, cette méthode retourne la valeur de paramètre str.

Notes

Si vous voulez lever l'exception si la valeur de propriété est une chaîne vide, définissez le paramètre d'checkEmpty valeur True.

Voir aussi

Référence

ConnectionSettings Classe

Surcharge ThrowIfPropertyNotSet

Espace de noms Microsoft.SqlServer.Management.Common