Export (0) Print
Expand All

ConnectionSettings.ThrowIfPropertyNotSet Method (String, String, Boolean)

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

Namespace:  Microsoft.SqlServer.Management.Common
Assembly:  Microsoft.SqlServer.ConnectionInfo (in Microsoft.SqlServer.ConnectionInfo.dll)

protected string ThrowIfPropertyNotSet(
	string propertyName,
	string str,
	bool checkEmpty
)

Parameters

propertyName
Type: System.String
A string that specifies the name of the connection property, such as "Login".
str
Type: System.String
A String object that contains the property value.
checkEmpty
Type: 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.

Return Value

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

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

Community Additions

ADD
Show:
© 2014 Microsoft