Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Mandar Shinde
1.6k
408
52.4k
Nested transactions using C#
Dec 2 2019 3:46 AM
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.
Reply
Answers (
2
)
Fix: Object reference not set to instance of object
Dynamic colour when ext:gridpanel load