Microsoft ActiveX Data ObjectsMicrosoft ActiveX Data Objects*
*Contents  *Index  *Topic Contents

ConnectionString Property - ADO

Contains the information used to establish a connection to a data source.

Applies To

Connection

Settings and Return Values

Sets or returns a String value.

Remarks

Use the ConnectionString property to specify a data source by passing a detailed connection string containing a series of argument = value statements separated by semicolons.

ADO supports seven arguments for the ConnectionString property; any other arguments pass directly to the provider without any processing by ADO. The arguments ADO supports are as follows:
Argument Description
Provider= Specifies the name of a provider to use for the connection.
Data Source= Specifies the name of a data source for the connection, for example, a SQL Server database registered as an ODBC data source.
User ID= Specifies the user name to use when opening the connection.
Password= Specifies the password to use when opening the connection.
File Name= Specifies the name of a provider-specific file (for example, a persisted data source object) containing preset connection information.
Remote Provider= Specifies the name of a provider to use when opening a client-side connection. (Remote Data Service only.)
Remote Server= Specifies the path name of the sever to use when opening a client-side connection. (Remote Data Service only.)

After you set the ConnectionString property and open the Connection object, the provider may alter the contents of the property, for example, by mapping the ADO-defined argument names to their provider equivalents.

The ConnectionString property automatically inherits the value used for the ConnectionString argument of the Open method, so you can override the current ConnectionString property during the Open method call.

Because the File Name argument causes ADO to load the associated provider, you cannot pass both the Provider and File Name arguments.

The ConnectionString property is read/write when the connection is closed and read-only when it is open.

Remote Data Service Usage When used on a client-side Connection object, the ConnectionString property can only include the Remote Provider and Remote Server parameters.

Examples

ConnectionString, ConnectionTimeout, and State Properties Example (VB)

See Also

Using OLE DB Providers with ADO


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.