Q:

Insert failure for multiple tables on bad server

I made a web application that onclick event of submit button saves the values coming from same form to 3 different tables. The problem i am facing is that when there is bad server or internet disconnect after user click on submit button then in some tables values get saved and in some it do not due to which my whole web application gives wrong output for reporting. Kindly let me know how to deal with such sort of issue. One solution i have in mind is to use one table instead of three but its a worst case scenario. Any help would be extremely appreciated Thanks,

A:

It sounds like you need to use a transaction to ensure your updates are atomic. Here is a link to some documentation that includes examples.

