This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.
This version is copyright and may only be used for local testing purposes. It may not be distributed.
Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.
Description
The Open method opens a connection to a data source.
When the connection is open, you can execute commands against the data source.
Syntax
n = <ADODB_Connection>.Open [(sConnectionString [, sUserId [, sPassword [, Options]]])]
Returns
Number: Connection State. See <ADODB_Connection>.State for possible values.
Parameters
Name |
Type |
Optional |
Meaning |
sConnectionString |
String |
Yes |
A string value that contains information about the connection. The string is composed of a series of parameter=value statements separated by semicolons. See the ConnectionString property for details. |
sUserId |
String |
Yes |
A String value that contains a user name for the connection |
sPassword |
String |
Yes |
A String value that contains a password for the connection |
sOptions |
Numeric |
Yes |
An OptionEnum value that determines whether this method should return after or before the connection is established.
Possible values: %adConnectUnspecified Default. Opens the connection synchronously (after). %adAsyncConnect Opens the connection asynchronously (before).
|
Remarks
Use <ADODB_Connection>.Close when finished to use a connection
Restrictions
See also
Examples
String sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & APP_SourcePath & "Biblio.mdb"
'---Declare a new pConnection variable
Dim pConnection As ADODB_CONNECTION
'---Instantiate it as new connection
pConnection = New ADODB_CONNECTION '[(sConn)]
'---Open indicating connection string
pConnection.Open(sConn)
Alternative
'---Declare a new pConnection variable and instantiate it in one line
Dim pConnection As New ADODB_CONNECTION '[(sConn)]
'---Set connection string
pConnection.ConnectionString = sConn
'---Open connection. Connection string is taken from ConnectionString property
pConnection.Open