Dear All,
I hope you are doing well. I am facing problem which is related to nested trasactions.
eg. :-
- MySqlConnection connection= new MySqlConnection(ConnectionString);
- MySqlTransaction myTrans = null;
- connection.Open();
- myTrans = connEpion.BeginTransaction();
- try{
- InsertOperation ....
- string result = InsertOperation2 ....
- myTrans.Committ();
- }
- catch(Exception ex)
- {
- Console.Write(ex.Message);
- }finally
- {
- connection.Close();
- }
InsertOperation2 is a function which is returning string result either exception or anything.
If I got any error then all insert operations should get rollback including operation which is performed in a method.
If I won't committ transaction then it will not save any data and Once if I commiitt any transaction then I am not able to rollback to it.
Thanking you in advance.
Regards.