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.
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 |
Dim objConnection
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=GuruList"
objConnection.ConnectionTimeout = 0
objConnection.Open