Compartir a través de


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

Throws an exception if the specified connection property is null or, optionally, empty.

Espacio de nombres:  Microsoft.SqlServer.Management.Common
Ensamblado:  Microsoft.SqlServer.ConnectionInfo (en Microsoft.SqlServer.ConnectionInfo.dll)

Sintaxis

'Declaración
Protected Function ThrowIfPropertyNotSet ( _
    propertyName As String, _
    str As String, _
    checkEmpty As Boolean _
) As String
'Uso
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

Parámetros

  • propertyName
    Tipo: System.String
    A string that specifies the name of the connection property, such as "Login".
  • checkEmpty
    Tipo: System.Boolean
    True if you want to check the property value for an empty string or null value; false if you want to check only for a null value.

Valor devuelto

Tipo: System.String
If the property is not set, this method throws a PropertyNotSetException. Otherwise, this method returns the str parameter value.

Comentarios

If you want to throw the exception if the property value is an empty string, set the checkEmpty parameter to true.

Vea también

Referencia

ConnectionSettings Clase

Sobrecarga de ThrowIfPropertyNotSet

Espacio de nombres Microsoft.SqlServer.Management.Common