ADODB Object
 
Syntax
 
connectionobject.Open [ConnectionString][, UserID][, Password][, Options]
 
Description
Opens a physical connection to a data source.
The Open method is used to establish (open) a physical connection to a data source. Once the connection is live, you can execute commands against the data source.
 
There are four optional parameters.
  
ADO supports five arguments for this string. (This is the same format as the ConnectionString property.) Please refer to the ConnectionString Property for examples.
 
Provider= is the name of the provider. If you use this parameter, you cannot use the File Name= parameter.
 
File Name= is the name of a file that contains the connection information. If you use this parameter, you cannot use the Provider= parameter.
 
Remote Provider= is the name of the provider that you use when you open a client-side connection. (for Remote Data Service)
 
Remote Server= is the path name to the server that you use when you open a client-side connection. (for Remote Data Service)
 
URL= is the absolute URL address to use for the connection.
 
Note: Duplicate parameters are ignored and only the last occurrence of a repeated parameter is used.
 
Parameter
Description
ConnectionString
The optional ConnectionString parameter is a string that contains the information needed to establish a connection to a data source. The string is composed of a series of parameter=value statements that are separated by semicolons. Note that the ConnectionString property inherits the values from the ConnectionString parameter of this method.
UserID
The optional UserID parameter is a string containing the user name to use when making the connection.
Password
The optional Password parameter is a string containing the password to use when making the connection.
Options
The optional Options parameter is one of the ConnectOptionEnum constants which specify how the Connection object should return: synchronously (the default) or asynchronously.
 
 
ConnectOptionEnum Constants 
 
Constant
Value
Description
adAsyncConnect
16
Open an asynchronous connection which returns before the connection is completed
adConnectUnspecified
-1
Default, open a synchronous connection which returns after the connection is completed
See Also
Connection, ConnectionString, Close, Record.Open, Recordset.Open, Stream.Open, Parameters.
Example
 
Dim objConnection
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString =
      "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=DataList"
objConnection.ConnectionTimeout = 0
objConnection.Open