SqlConnectionStringBuilder::ContainsKey Method (String^)
Determines whether the SqlConnectionStringBuilder contains a specific key.
Assembly: System.Data (in System.Data.dll)
Parameters
- keyword
-
Type:
System::String^
The key to locate in the SqlConnectionStringBuilder.
Return Value
Type: System::Booleantrue 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.
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
Available since 2.0