I am a newbie in C#. So i was just wondering if anybody can help me figure out how C# works with transactionscope? Because i am a little confused by the definition of it. However, let me explain about my problem a little bit. So that you will get to know what i am trying to achieve.
I have three table adapter declared for three different dataset like this:
logTableAdapter logAdap = new logTableAdapter();
measTableAdapter measAdap = new measTableAdapter();
valueTableAdapter valueAdap = new valueTableAdapter();
The process to import data is:
- First I insert a log entry via logAdap.insert() method.
- Loop through an excel file to grab the measurements and starts inserting via measAdap.insert() method.
- Foreach measurement i am inserting values via valueAdap.insert() method.
So my question is - since measurement & value has a nested relationship. How can I create a nested transactionscope & when an error occur anywhere (measurement insertion / value insertion) i just want to rollback everything i did. That is i just want to go back to the point before the i inserted the log entry.