Sunday, February 15, 2015

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 want to access a database multiple times, you should establish a connection using the Connection object. You can also make a connection to a database by passing a connection string via a Command or Recordset object. However, this type of connection is only good for one specific, single query.

ProgID

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

Properties

PropertyDescription
AttributesSets or returns the attributes of a Connection object
CommandTimeoutSets or returns the number of seconds to wait while attempting to execute a command
ConnectionStringSets or returns the details used to create a connection to a data source
ConnectionTimeoutSets or returns the number of seconds to wait for a connection to open
CursorLocationSets or returns the location of the cursor service
DefaultDatabaseSets or returns the default database name
IsolationLevelSets or returns the isolation level
ModeSets or returns the provider access permission
ProviderSets or returns the provider name
StateReturns a value describing if the connection is open or closed
VersionReturns the ADO version number

Methods

MethodDescription
BeginTransBegins a new transaction
CancelCancels an execution
CloseCloses a connection
CommitTransSaves any changes and ends the current transaction
ExecuteExecutes a query, statement, procedure or provider specific text
OpenOpens a connection
OpenSchemaReturns schema information from the provider about the data source
RollbackTransCancels any changes 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++ languages can handle events).
EventDescription
BeginTransCompleteTriggered after the BeginTrans operation
CommitTransCompleteTriggered after the CommitTrans operation
ConnectCompleteTriggered after a connection starts
DisconnectTriggered after a connection ends
ExecuteCompleteTriggered after a command has finished executing
InfoMessageTriggered if a warning occurs during a ConnectionEvent operation
RollbackTransCompleteTriggered after the RollbackTrans operation
WillConnectTriggered before a connection starts
WillExecuteTriggered before a command is executed

Collections

CollectionDescription
ErrorsContains all the Error objects of the Connection object
PropertiesContains all the Property objects of the Connection object

No comments:

Post a Comment