I have some piece of code in my Website which adds the details into tables. Now I want that if some error occurs the previously entered data should be removed. How can I implement it with the help of transactions??
A:
We need more details such as what database you are using and so forth. Basically you do this:
Create a transaction
Do some work in the context of that transaction
Do some more work in the context of that transaction
...
If an exception occurred, rollback the transaction, else commit.
BobbyShaftoe
2009-04-23 10:13:25
I am using SQL Server 2005 database. I am writung the code in C#
Roshan
2009-04-23 10:16:57
Look at SqlTransaction
Sam Saffron
2009-04-23 11:33:06