Parameters Collection
Close Method
ConnectionString Property
Connection Object
Record Open Method
Recordset Open Method
Stream Open Method
METHOD Connection::Open
connectionobject.
Open
ConnectionString, UserID, Password, Options
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.
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.
Please refer to the
ConnectionString
Property for examples.
ADO supports five arguments for this string. (This is the same format as the
ConnectionString
property.)
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.
The optional
UserID
parameter is a string containing the user name to use when making the connection.
The optional
Password
parameter is a string containing the password to use when making the connection.
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
Code (VBScript):
Dim objConnection
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=GuruList"
objConnection.ConnectionTimeout = 0
objConnection.
Open
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information