Transaction Processing
Often, updates to tables must occur as a grouped operation. For instance, suppose that within an operation you must update multiple tables. If the update operation on any of the tables fails, the entire operation must fail. This includes previous updates to other tables within the same operation.
This type of protection can be achieved using transaction processing. Transactions are statements that define the beginning and ending of operation boundaries. Transactions are represented by the SqlTransaction class. This class is returned as the result of the SqlConnection.BeginTransaction() method.
When a transaction is invoked, all operations through the specified connection occur within the transaction’s boundaries. When the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access