Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Implementing Transaction Control in ASP.net

  • 23-04-2012 11:33AM
    #1
    Registered Users, Registered Users 2 Posts: 9,599 ✭✭✭


    I have a master table, let's call it ORDER_HEADERS and a one-to-many related child table, let's call it ORDER_ITEMS.

    Let's say my app is just one page, edit items for the ORDER_HEADERS record at the top and a grid at the bottom for the ORDER_ITEMS where fields can be edited in-line (within the grid itself).

    I want to cater for the following scenario : user goes to edit an order, makes changes to ORDER_HEADER fields and also updates and adds ORDER_ITEMS fields. User suddenly realises that she's in the wrong order and wants to undo changes to both the ORDER_HEADER and ORDER_ITEMS tables.

    It's easy to undo the ORDER_HEADER record changes by basically never executing the appropriate UPDATE statement.

    However, with the child records, things are more difficult.

    What I'd like to do is wrap all the child updates, deletes, inserts in a transaction. At the moment I'm using an ObjectDataSource to connect to my table adaptor in my DAL.

    I've seen plenty of examples of transactioning where everything is done in one code block (e.g. establish connection - begin transaction - do sql comm 1 - do sql comm2 - commit), but how should I go about implementing transaction control at the DAL table adaptor level and keep my objects there persistent?


Comments

Advertisement
Advertisement