Export (0) Print
Expand All

DbConnectionStringBuilder::Item Property

Gets or sets the value associated with the specified key.

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

[BrowsableAttribute(false)]
public:
virtual property Object^ Item[String^ keyword] {
	Object^ get (String^ keyword);
	void set (String^ keyword, Object^ value);
}

Parameters

keyword
Type: System::String

The key of the item to get or set.

Property Value

Type: System::Object
The value associated with the specified key. If the specified key is not found, trying to get it returns a null reference (Nothing in Visual Basic), and trying to set it creates a new element using the specified key.
Passing a null (Nothing in Visual Basic) key throws an ArgumentNullException. Assigning a null value removes the key/value pair.

ExceptionCondition
ArgumentNullException

keyword is a null reference (Nothing in Visual Basic).

NotSupportedException

The property is set, and the DbConnectionStringBuilder is read-only.

-or-

The property is set, keyword does not exist in the collection, and the DbConnectionStringBuilder has a fixed size.

When you set this property, if the specified key already exists in the dictionary, the value is replaced; otherwise, a new element is created.

The following console application creates a new DbConnectionStringBuilder and adds key/value pairs to its connection string, using the Item property.

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft