jesbon

jesbon

  • NA
  • 17
  • 0

Help with SQL query - inserts with OracleTransaction (from C#/asp.net)

Mar 8 2010 6:25 PM
Hi,
I need advice how to accomplish example as described below.

I have one table INVOICE_HEADER and one table INVOICE_ITEM. I want to first insert data into table INVOIC_HEADER (data received from SELECT sql query). Then I want to insert data into table INVOICE_ITEM (data received from SELECT sql query). I want that no commit of table INVOICE_HEADER should be done if input data is not correct of some reason. I also want that inserted data into table INVOICE_HEADER not should be commited if insert of data in table INVOICE_ITEM fails of some reason. With other/shorter words I just want that inserts for both tables should be commited if inserts in both tables are successful.

Any kind of advice/hints are highly appreciated! I have made a "search" of how to solve this and think that the best solution is to use OracleTransaction (C#) in some way but I can't get it to work.

Thx in advance!

Answers (2)