Last post Aug 10, 2010 03:29 AM by RaviKaria
Aug 10, 2010 02:35 AM|rajunitw|LINK
i am developing the web application in asp.net 3.5 and c# with oracle database, but i have to save my data in two and more than two tables. if i get any exception in the second insertion need to rollback my present(fisrt) transaction. how should i handle
please help me....
Thanks in Advance......
Aug 10, 2010 03:29 AM|RaviKaria|LINK
You can handle this in two way 1) commit/rollback through .Net 2) commit/rollback in oracle
1) Commit/rollback through .Net: In this case, you make storedprocedure in oracle where you will write insert statement for both the tables. If any one fails then you have to handle the oracle exception in SP and raise it. So in .net, if you get an error
while executing SP then you rollback it using .net transaction class dg. TransactionScope.
2) Commit/rollback in oracle: In this case, you handle commit/rollaback in oracle storedprocedure itself. So no need to handle transcation in .Net.
Hope this will solve your problem..