Easy Tutorial
❮ Ado Recordset Ado Ref Parameter ❯

ADO Connection Object


Connection Object

The ADO Connection object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database.

If you need to access a database multiple times, you should use the Connection object to establish a connection. You can also create a connection by passing a connection string through a Command or Recordset object. However, such connections are only suitable for a single, simple query.

ProgID


Properties

Property Description
Attributes Sets or returns properties of the Connection object.
CommandTimeout Indicates the time to wait before terminating an attempt to execute a command and generating an error.
ConnectionString Sets or returns details used to establish a connection to a data source.
ConnectionTimeout Indicates the time to wait before terminating an attempt to establish a connection and generating an error.
CursorLocation Sets or returns the location of the cursor service.
DefaultDatabase Indicates the default database for the Connection object.
IsolationLevel Indicates the isolation level for the Connection object.
Mode Sets or returns the access permissions for the provider.
Provider Sets or returns the name of the provider for the Connection object.
State Returns a value describing whether the connection is open or closed.
Version Returns the ADO version number.

Methods

Method Description
BeginTrans Begins a new transaction.
Cancel Cancels an execution.
Close Closes a connection.
CommitTrans Saves any changes and ends the current transaction.
Execute Executes a query, SQL statement, stored procedure, or provider-specific text.
Open Opens a connection.
OpenSchema Returns schema information about the data source from the provider.
RollbackTrans Cancels any changes made in the current transaction and ends the transaction.

Events

Note: You cannot handle events using VBScript or JScript (only Visual Basic, Visual C++, and Visual J++ can handle events).

Event Description
BeginTransComplete Triggered after the BeginTrans operation.
CommitTransComplete Triggered after the CommitTrans operation.
ConnectComplete Triggered after a connection begins.
Disconnect Triggered after a connection ends.
ExecuteComplete Triggered after a command execution completes.
InfoMessage Triggered if a warning occurs during a ConnectionEvent operation.
RollbackTransComplete Triggered after the RollbackTrans operation.
WillConnect Triggered before a connection begins.
WillExecute Triggered before a command is executed.

Collections

Collection Description
Errors Contains all Error objects for the Connection object.
Properties Contains all Property objects for the Connection object.
❮ Ado Recordset Ado Ref Parameter ❯