SqlConnectionStringBuilder::ContainsKey Method (String^)

 

Determines whether the SqlConnectionStringBuilder contains a specific key.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
virtual bool ContainsKey(
	String^ keyword
) override

Parameters

keyword
Type: System::String^

The key to locate in the SqlConnectionStringBuilder.

Return Value

Type: System::Boolean

true if the SqlConnectionStringBuilder contains an element that has the specified key; otherwise, false.

Exception Condition
ArgumentNullException

keyword is null (Nothing in Visual Basic)

Because the SqlConnectionStringBuilder contains a fixed-size collection of key/value pairs, the ContainsKey method determines only if a particular key name is valid.

The following example creates a SqlConnectionStringBuilder instance, sets some of its properties, and then tries to determine whether various keys exist within the object by calling the ContainsKey method.

No code example is currently available or this language may not be supported.

The example displays the following output in the console window:

Connection string = Data Source=(local);Initial Catalog=AdventureWorks;Integrated Security=True
True
True
True
False

.NET Framework
Available since 2.0
Return to top
Show: