Latest web development tutorials

ADO Connection Object

Connection Object

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

If you need to repeatedly access a database, you should use the Connection object to establish a connection. You can also pass a connection string to create a connection via a Command or Recordset object. However, such a connection only for specific simple query.

ProgID

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

Attributes

Attributes description
Attributes Sets or returns the property Connection object.
CommandTimeout Instructions before terminating the attempt and generating an error to wait for a period of time to execute commands.
ConnectionString Sets or returns the details of the data source used to establish a connection.
ConnectionTimeout Instructions before terminating the attempt and generating an error during the connection establishment of the waiting time.
CursorLocation Sets or returns the position of the cursor service.
DefaultDatabase It indicates the default database Connection objects.
IsolationLevel It indicates the isolation level of a Connection object.
Mode Sets or returns the access provider.
Provider Sets or returns the Connection object provider name.
State Returns a description of the connection is open or closed values.
Version Returns ADO version number.

method

method description
BeginTrans Start a new transaction.
Cancel Cancel the first performance.
Close Close a connection.
CommitTrans Saves any changes and ends the current transaction.
Execute Execute the query, SQL statement, stored procedure, or provider specific text.
Open Open a connection.
OpenSchema Returns information about the data source schema information from the provider.
RollbackTrans Cancels any changes made in the current transaction and ends the transaction.

event

Note: You can not use VBScript or JScript to handle events (only use Visual Basic, Visual C ++ and Visual J ++ language processing events).

event description
BeginTransComplete It is triggered after a BeginTrans operation.
CommitTransComplete It is triggered after the CommitTrans operation.
ConnectComplete Fires after a connection start.
Disconnect It is triggered after a connection ends.
ExecuteComplete Triggered after a command is executed.
InfoMessage If a warning occurs during a ConnectionEvent operation is triggered the event.
RollbackTransComplete RollbackTrans is triggered after the operation.
WillConnect It is triggered before a connection start.
WillExecute It is triggered before a command is executed.

set

set description
Errors All Error object contains Connection object.
Properties All Property object contains Connection object.