Name

Connection.Open Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

                     connection.Open ConnectionString, UserID, Password, Options
                  

The Open method for the Connection object opens a connection to a particular data source. The Open method for the Recordset object opens a cursor.

Arguments

ConnectionString (String)

Optional. Contains the information needed for ADO to connect to the data provider. This property is mapped to the Connection.ConnectionString property.

UserID (String)

Optional. Contains a username that is used to establish the desired connection.

Password (String)

Optional. Contains a password that is used to establish the desired connection.

Options (Long)

Optional. Represents a ConnectOptionEnum enumeration value. Currently, the only defined value for the ConnectOptionEnum enumeration is adAsyncConnect (16) which instructs ADO to connect to the data source asynchronously. The default value is -1 (no options set).

Description

The Open method establishes a connection with a data provider. Once a connection is established, you can issue commands against the data provider and obtain information from the data source.

The connection to a data provider can be established asynchronously by passing the adConnectAsync value to the Options parameter of the Open method. Once the operation has started, the application can call the Connection.Cancel method to cancel the pending asynchronous connection if the application has determined that the connection is taking too long.

The connection to ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.