YouTip LogoYouTip

Ado Ref Connection

ADO Connection Object

ADO 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 certain database multiple times, you should use the Connection object to establish a connection. You can also pass a connection string to a Command or Recordset object to create a connection. However, such connections are only suitable for one specific simple query.

ProgID

set objConnection = Server.CreateObject("ADODB.Connection")

Properties

Property Description
Attributes Sets or returns the attributes of the Connection object.
CommandTimeout Indicates how long to wait before terminating an attempt and producing an error while executing a command.
ConnectionString Sets or returns details about the information needed to establish a connection to the data source.
ConnectionTimeout Indicates how long to wait before terminating an attempt to establish a connection and producing an error.
CursorLocation Sets or returns the location of the cursor service.
DefaultDatabase Indicates the default database of the Connection object.
IsolationLevel Indicates the isolation level of the Connection object.
Mode Sets or returns the access permissions of the provider.
Provider Sets or returns the name of the Connection object provider.
State Returns a value describing whether the connection is open or closed.
Version Returns the version number of ADO.

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 from the provider about the data source.
RollbackTrans Cancels any changes made in the current transaction and ends the transaction.

Events

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

Event Description
BeginTransComplete Fired after a BeginTrans operation.
CommitTransComplete Fired after a CommitTrans operation.
ConnectComplete Fired when a connection starts.
Disconnect Fired when a connection ends.
ExecuteComplete Fired after a command executes.
InfoMessage Fired if a warning occurs during a ConnectionEvent operation.
RollbackTransComplete Fired after a RollbackTrans operation.
WillConnect Fired before a connection starts.
WillExecute Fired before a command executes.

Collections

Collection Description
Errors Contains all Error objects of the Connection object.
Properties Contains all Property objects of the Connection object.
← Ado Ref ErrorAdo Command β†’