Adds an entry with the specified key and value into the DbConnectionStringBuilder.
Assembly: System.Data (in System.Data.dll)
The Item property can also be used to add new elements by setting the value of a key that does not exist in the dictionary. For example: myCollection["myNonexistentKey"] = myValue.
Calling the method by passing a null (Nothing in Visual Basic) key throws an ArgumentNullException. However, calling the method by passing a null value removes the key/value pair.
The following example creates a new DbConnectionStringBuilder and adds items. The code also demonstrates overwriting an existing item using the method, and includes a commented block that would throw an ArgumentNullException.
This example includes a password to demonstrate how DbConnectionStringBuilder works with connection strings. In your applications, we recommend that you use Windows Authentication. If you must use a password, do not include a hard-coded password in your application.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.