Connection Attributes

Depending on the

Connection
object's
Attributes
property, calling either the
CommitTrans
or
RollbackTrans
methods may automatically start a new transaction. If the
Attributes
property is set to
adXactCommitRetaining
, ADO automatically starts a new transaction after a
CommitTrans
call. If
Attributes
is set to
adXactAbortRetaining
, ADO automatically starts a new transaction after a
RollbackTrans
call.

Take care to note what state the driver is in. The ODBC provider for ADO does not support multiple simultaneous transactions within a single connection. As such, if we attempt a

BeginTrans
and the previous
CommitTrans
automatically created a new transaction, an error will result.

Note that once you start a transaction yourself, rather than having it started automatically, you will have to manually manage transactions until the connection is closed and reopened.

© 1997 by Wrox Press. All rights reserved.