I am writing an application in C# (For the first time). I have a user inputting a lot of data in forms and I am inserting this data in to the database. It is a Windows Forms Application using SQL Server.
After a form is submitted by the user multiple tables are updated. (Around 6) I am trying to avoid a situation where 3 tables are updated and the 4th throws an error and I'm not sure how to do this. All of the data will be the correct data type so my question is more on the database connection end.
So, ideally, if all 6 inserts aren't successful I would like none of them to be successful. I know I can do a delete record in the catch clause to roll back. Is this the most efficient way or is there a "best practice" when it comes to this?