Transaction Question

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

Hi,

Can someone explain to me how the transaction object works behind the
scenes? I am currently using it in my updates and it works great. I was
curious how the rollback works and the update (added, modified and deleted
rows) actually are changed at the time of call to the dataadapter or when I
commit the changes?

Thanks
 
There are slight differences in how transactions behave, depending on
the server. For example, Access/Jet and SQL Server don't process
transactions the same way. That being said, the basic idea of explicit
transactions is that all operations participating in the transaction
are treated as a single unit of work, where all operations are
committed at the same time, or else all are rolled back if there is an
error or failure in any part.

--Mary
 
Yes and no. With SQL Server you automatically get more robust
transaction processing. If you have only single statements/operations,
there is no benefit to wrapping them in explicit transactions because
SQL Server takes care of ensuring that all implicit transactions are
safely committed (passing the ACID test) or else are rolled back in
case of failure. If you have multiple operations that you want treated
as a single unit of work, then writing a stored procedure with BEGIN
TRAN, COMMIT TRAN and ROLLBACK TRAN statements is the preferred choice
in terms of efficiency and error handling. See the Transactions,
Transactions Architecture, and Explicit Transactions topics in SQL
Books Online for more info.

--Mary
 
Back
Top