Transaction Not Fully Commited
Posted by:
Teddy Cooper ()
Date: December 30, 2012 02:04AM
I am having a problem with a transaction.
Environment:
- C# ASP.NET
- MySQL 5.1.51
Tables:
- tbl_book
- tbl_pages
My code flow basically works like this:
1) Start Transaction
2) Call a stored procedure (book_new) to insert a new book record into tbl_book and return the inserted book id using LAST_INSERT_ID
3) In my code, I can read the returned Book ID
4) In my code, in a loop, generate a page and call another stored procedure (page_new) to insert the new page record into tbl_pages with the Book ID as foreign key
5) After generating all the pages (around 15 ~ 100 records, usually takes about 45 ~ 90 seconds), the transaction is committed.
The problem:
tbl_pages has all the records with the Book ID, however, tbl_book has no record with Book ID.
In another word, the transaction only commits half of the statements.
Any idea why?
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.