12.8. Using transactions

A transaction is a series of operations performed as single unit of work. All operations in a transaction must be completed successfully in order to make the transaction successful. The transaction has a beginning and an end that specify the boundary of the transaction. Usually we use transactions in a stored procedure with the help of BEGIN TRANSACTION and COMMIT/ROLLBACK TRANSACTION statements – these allow us to run the transaction in a single round trip to the database server.

ADO.NET supports manual transactions – we can control the transaction boundary and explicitly start and end transactions. To perform operations within a single transaction, we need to create an SqlTransaction or OleDbTransaction object and ...

Get A Programmer's Guide to .NET 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.