I'm trying to use the TransactionScope class in my C# application.
Here's my code :
Code: Select all
using (TransactionScope t = new TransactionScope(TransactionScopeOption.RequiresNew))
{
MySqlConnection cn = new MySqlConnection();
cn.ConnectionString = connectionString;
cn.Open();
MySqlCommand c = new MySqlCommand("INSERT INTO operateur.privileges(alias) VALUES('plop')", cn);
c.ExecuteNonQuery();
MySqlCommand c2 = new MySqlCommand("INSERT INTO operateur.privileges(alias) VALUES('plop2')", cn);
c2.ExecuteNonQuery();
t.Complete();
}
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'XA BEGIN 'dc8e807b-222b-b3c4-e44c-a9be85f7dd88,-a9fb-cf5eb572459f'' at line 1
If I execute the same code not using the TransactionScope, it works perfectly...
Have you got an idea of what is the issue?
Thank you for helping me !