The Connection Object - The State Property and Version Property
(Page 10 of 15 )
This property describes whether the Connection object is open or closed. For asynchronous connections it also indicates whether the state is connecting, opening, or retrieving.
Long = Connection.State
This will be one of the following ObjectStateEnum constants:
- adStateOpen for an open connection
- adStateClosed for a closed connection
- adStateConnecting for an asynchronous connection still connecting to a provider
- adStateExecuting for an asynchronous connection executing a command
- adStateFetching for an asynchronous connection fetching data
You can use the State property to ensure that you don’t generate errors when closing a connection. For example, to ensure that a transaction is committed:
If objConn.State = adStateOpen Then
objConn.CommitTrans
objConn.Close
End If
The Version Property
This property indicates the version number of the MDAC components.
String = Connection.Version
Note that the provider’s version number can be obtained from the Connection object’s Properties collection.
This property is read-only.
This is from ADO Programmer's Reference, by Dave Sussman (Apress, ISBN 1590593421). Check it out at your favorite bookstore today. Buy this book now. |
Next: Events of the Connection Object >>
More ASP.NET Articles
More By Apress Publishing