Chapter 31. The Transaction Class

Transactions ensure that a set of related operations are all completed or are aborted, leaving the involved resources in the state that they were in when the transaction was started. Transactions are most commonly used in data-oriented situations in which all related operations must be completed successfully (e.g., debiting and crediting respective bank accounts when funds are transferred from one to the other). The related operations are bound together into a transactional unit of work that must either completely succeed or completely fail; this is referred to as committing or aborting the transaction.

Transactions can occur within a single data resource, with the data resource providing transaction functionality and controlling the transaction. Transactions can also span multiple data resources. These distributed transactions are generally managed by an external transaction processing system.

Get ADO.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.