Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Implementing Transaction Control in ASP.net

Options
  • 23-04-2012 11:33am
    #1
    Registered Users Posts: 9,557 ✭✭✭


    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