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::Provider Property

 

Gets or sets a string that contains the name of the data provider associated with the internal connection string.

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

public:
property String^ Provider {
	String^ get();
	void set(String^ value);
}

Property Value

Type: System::String^

The value of the Provider property, or String.Empty if none has been supplied.

If the value passed in is null when you try to set the property, the Provider property is reset. If the value has not been set and the developer tries to retrieve the property, the return value is String.Empty. This property corresponds to the "Provider" key within the connection string.

Setting the value of the Provider property, either directly (by setting the ConnectionString property) or by passing a connection string as a parameter to the constructor, may affect the set of key/value pairs that are contained within the OleDbConnectionStringBuilder instance. Setting the Provider property to "sqloledb," for example, adds all the standard SQL connection string properties. See the example in this topic for a demonstration of this behavior.

For some providers, assigning a connection string within the OleDbConnectionStringBuilder constructor causes the order of supplied key/value pairs to be rearranged.

The following example creates multiple OleDbConnectionStringBuilder instances, passing a different connection string to the constructor in each case. Note how setting the provider associated with the connection changes the set of predefined key/value pairs within the object's collection.

System_CAPS_noteNote

This example includes a password to demonstrate how OleDbConnectionStringBuilder 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.

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