Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OleDbConnectionStringBuilder::Item Property (String^)

 

Gets or sets the value associated with the specified key. In C#, this property is the indexer.

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

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

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.

Exception Condition
ArgumentException

The connection string is incorrectly formatted (perhaps missing the required "=" within a key/value pair).

ArgumentNullException

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

Because setting the Provider property may add corresponding items to the collection of key/value pairs (depending on the behavior of the specific provider), you may be able to retrieve a value for a key you have not set explicitly. For example, as soon as you have set the Provider property to "sqloledb," you can retrieve the "Workstation ID" value even if you have not set it yourself. See the example in this topic for a demonstration.

The following example uses the Item property (the indexer, in C#) to retrieve and set values within the collection of key/value pairs. Note that setting the provider, in this case, also provides default values for all the key/value pairs associated with the selected provider.

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft