Controlling Transactions

Microsoft ActiveX Data Objects (ADO)

ADO 2.5

Controlling Transactions

A transaction delimits the beginning and end of a series of data access operations that transpire across a connection. Subject to the transactional capabilities of your data source, the Connection object also allows you to create and manage transactions. For example, using the Microsoft OLE DB Provider for SQL Server to access a database on Microsoft SQL Server 2000, you can create multiple nested transactions for the commands you execute.

ADO ensures that changes to a data source resulting from operations in a transaction occur successfully together or not at all.

If you cancel the transaction, or if one of its operations fails, the ultimate result will be as if none of the operations in the transaction occurred. The data source will remain as it was before the transaction began.

The ADO object model does not explicitly include transactions, but represents them with a set of Connection object methods (BeginTrans, CommitTrans, and RollbackTrans).

For more information about transactions, see Chapter 5: Updating and Persisting Data.

© 1998-2003 Microsoft Corporation. All rights reserved.