How to implement nested transaction



Hi, all,

In some cases we need insert data into several tables, for example, after we placed an order, we may insert record into table Order and table OrderDetails, or any other related tables, what I want is: if there was an exception threw out during we insert data into whichever table, all the insertion to those tables should be rolled back.

The underlying database is MS SQL Server 2005 express. I wrote some nested trans scripts in the query builder, but only the table threw out exception had been rolled back, other tables would be inserted and not rolled back at all.

Any instruction would be greatly appreciated.

Jack

.



Relevant Pages

  • Re: You wanted defensive writing...
    ... Couldn't you have set the debugger to break on all exceptions? ... > I've created an application that loads Caudill's TreeListView as its ... > I commented the line that called the insertion on start-up, ... > The exception caught me unaware, ...
    (microsoft.public.dotnet.csharp.general)
  • Re: You wanted defensive writing...
    ... Couldn't you have set the debugger to break on all exceptions? ... > I've created an application that loads Caudill's TreeListView as its ... > I commented the line that called the insertion on start-up, ... > The exception caught me unaware, ...
    (microsoft.public.dotnet.general)
  • Re: DbProviderFactory and transactions.
    ... Using transactions if when I check I see I can proceed to insertion and ... You won't have an exception. ... If you have a serializable transaction and ...
    (microsoft.public.dotnet.languages.csharp)