How To Implement Nested Transactions with ADO and SQL Server (238163)
The information in this article applies to:
- ActiveX Data Objects (ADO) 2.0
- ActiveX Data Objects (ADO) 2.01
- ActiveX Data Objects (ADO) 2.1
- ActiveX Data Objects (ADO) 2.1 SP1
- ActiveX Data Objects (ADO) 2.1 SP2
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
This article was previously published under Q238163 SUMMARY ADO, with both SQLOLEDB and MSDASQL providers, does not
support nested transactions with SQL Server. However, native T-SQL commands can
still be used with ADO to implement nested transactions against SQL Server.
This can be accomplished in two different ways:
Model-1: Without using save points - Begin OuterTrans - Begin InnerTrans1 - Begin
InnerTrans2 - Begin InnerTrans3
Analysis: Committing OuterTrans commits all nested transactions.
Rolling back OuterTrans rolls back all nested transactions.
Model-2: Using save points: - Begin OuterTrans - Save InnerTrans1 - Save
InnerTrans2 - Save InnerTrans3
Analysis: Committing OuterTrans commits all nested transactions.
Rolling back any saved inner-transaction point rolls back all transactions
nested under that point. Saved points can be used to roll back nested
transactions from a given point on without affecting transactions nested under
different saved points. REFERENCES For additional information, please click the article
numbers below to view the articles in the Microsoft Knowledge Base: 177138 INFO: Nested Transactions Not Available in ODBC/OLE DB/ADO
198024 INFO: Understanding ADO Transactions with MS SQL Server
SQL Server Books on Line, documentation.
| Modification Type: | Minor | Last Reviewed: | 7/1/2004 |
|---|
| Keywords: | kbDatabase kbhowto KB238163 |
|---|
|