ConnectionSettings.ThrowIfPropertyNotSet 方法 (String, String, Boolean)

如果指定的连接属性为 Null 或为空(后者为可选项),将引发异常。

命名空间:  Microsoft.SqlServer.Management.Common
程序集:  Microsoft.SqlServer.ConnectionInfo(在 Microsoft.SqlServer.ConnectionInfo.dll 中)

语法

声明
Protected Function ThrowIfPropertyNotSet ( _
    propertyName As String, _
    str As String, _
    checkEmpty As Boolean _
) As String
用法
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

参数

  • propertyName
    类型:String
    一个指定连接属性名称(例如“Login”)的字符串值。
  • str
    类型:String
    包含属性值的 String 对象。
  • checkEmpty
    类型:Boolean
    如果您要检查属性值是否为空字符串或 Null 值,则为 True;如果您要仅检查 Null 值,则为 false。

返回值

类型:String
如果未设置该属性,则此方法将引发 PropertyNotSetException。否则,此方法返回 str 参数值。

注释

如果要引发异常 , 则该值为空字符串 , 请将 checkEmpty 参数设置为 TRUE。

请参阅

参考

ConnectionSettings 类

ThrowIfPropertyNotSet 重载

Microsoft.SqlServer.Management.Common 命名空间