Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=130500016

Connection Object, ActiveX Data Objects Component (ADO), ASP Server Component, Built-in Function

Connection Object

Connection object of ActiveX Data Object component is related to manipulate the connection session with a data source. The Connection Object should be created by a Server.CreateObject Method such that the Web server can make a connection with a data source.

Although an instance of the Connection object of the ADODB Library has higher hierarchical relationship with other ADO objects in the ADODB Library, ADO objects can also be created outside the scope of the ADO hierarchy. When a Recordset or Command object is created, it is not necessary to create a connection first, because the Recordset or Command object is just a place holder. When a Recordset or Command object is opened, it is also not necessary to create a connection first, because a Connection object is automatically created behind the scenes according to the specified ConnectionString in the line of code. 

Syntax

Set ConnName = Server.CreateObject("ADODB.Connection")

Parameters

ConnName

The parameter "ConnName" is the name assigned to the instance of the Connection object of the ADODB Library created by the call using the Server.CreateObject.

ADODB.Connection

The parameter "ADODB.Connection" is used to specified the name of the type of ADO DataBase object included in the ADODB Library to be created by the Server.CreateObject Method.

Methods

Method Description
BeginTrans to begin a new transaction
Cancel to cancel the execution of a pending asynchronous method call.
Close to close an open object and any dependent objects
CommitTrans to end the current transaction and save any changes. A new tracnsaction may be started also.
Execute to execute the specified command text of query, SQL statement, stored procedure or provider-specific text.
Open to open an connection instance to a data source
OpenSchema to obtain the database schema information from the provider
RollbackTrans to end the transaction and cancel any changes made during the current transaction. A new tracnsaction may be started also.

Properties

Property Description
Attributes to set or return the value of XactAttributeEnum attribute for a Connection object
CommandTimeout to set or return the waiting time for executing a command before terminating and generating an error.
ConnectionString to set or return the details used for creating a connection instance to a data source 
ConnectionTimeout to set or return the waiting time for establishing a connection before terminating and generating an error.
CursorLocation to set or return the location of the cursor service
DefaultDatabase to set or return the default database name for a connection object
Errors to contains all the error objects created in response to a single provider-related failure.
IsolationLevel to set or return the level of isolation for a connection object
Mode to set or return the available accessing permissions for modifying data in a connection
Properties to contains all the property objects for a specific instance of a connection object
Provider to set or return the provider name of a connection object
State to return a value to indicate the state of connection is open or closed
Version to return the ADO version number

Events

Event Description
   

Remarks

The methods and properties of Connection object can be grouped into

  •  Connection Information 
    • Connection Details: ConnectionString; DefaultDatabase; Errors; Properties; State
    • Connection Provider Information: OpenSchema; Provider; Version
  •  Connection Manipulation 
    • Connection Transaction: BeginTrans; CommitTrans; RollbackTrans; Attributes
    • Connection Object Manipulation: Cancel; Close; Execute; Open
    • Connection Control: CommandTimeout; ConnectionTimeout; CursorLocation; IsolationLevel; Mode
Previous Month  MAY  2013  Next Month
SMTWTFS
1234
567891011
12131415161718
19202122232425
262728293031

Previous Month  FEB  2011  Next Month
SMTWTFS
12345
6789101112
13141516171819
20212223242526
2728

Sideway BICK Blog

15/05


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013