Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
What do you need to do if you will insert and update data in more than one table in the database to make sure that if a problem happened during inserting or updating a command in your application, the tables don't be changed ??
Posted

1 solution

Read on SQL Transaction.

Here: SqlTransaction Class for ADO.NET way[^]
BEGIN Transaction - DB way[^]
COMMIT Transaction - DB way[^]

Using them, if needed, you can either commit all or rollback all based on failure of any one.
 
Share this answer
 
Comments
SerpentKiss2010 7-Apr-11 12:24pm    
Thank you soooo much ....
Sandeep Mewara 7-Apr-11 12:42pm    
Glad it helped. :)
walterhevedeich 7-Apr-11 23:03pm    
Good advice. voted 5.
Sandeep Mewara 8-Apr-11 1:02am    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900