Share via


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

Inicia una excepción si la propiedad de conexión especificada es NULL o está vacía.

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: String
    Cadena que especifica el nombre de la propiedad de la conexión, por ejemplo "Inicio de sesión".
  • str
    Tipo: String
    Valor del objeto String que contiene el valor de la propiedad.
  • checkEmpty
    Tipo: Boolean
    True si desea comprobar el valor de la propiedad de una cadena vacía o el valor NULL; false si solo desea comprobar un valor NULL.

Valor devuelto

Tipo: String
Si la propiedad no está establecida, este método inicia una excepción PropertyNotSetException.En caso contrario, este método devuelve el valor de parámetro str.

Comentarios

Si desea producir una excepción si el valor de propiedad es una cadena vacía, establezca el parámetro de checkEmpty en true.

Vea también

Referencia

ConnectionSettings Clase

Sobrecarga de ThrowIfPropertyNotSet

Espacio de nombres Microsoft.SqlServer.Management.Common