private void bnBug50773_Click(object sender, EventArgs e) { MySqlConnection conn = new MySqlConnection("DataSource=**;Database=test;UserID=root;Password=**;PORT=**;logging=true"); conn.Open(); MySqlCommand cmdsetup = new MySqlCommand("DROP TABLE IF EXISTS bug50773", conn); cmdsetup.ExecuteNonQuery(); cmdsetup.CommandText = "CREATE TABLE bug50773(Id int(10) unsigned NOT NULL default '0', PRIMARY KEY (Id))ENGINE=InnoDB"; cmdsetup.ExecuteNonQuery(); cmdsetup.CommandText = "SET autocommit = 0"; cmdsetup.ExecuteNonQuery(); cmdsetup.CommandText = "SET sql_mode=TRADITIONAL"; cmdsetup.ExecuteNonQuery(); cmdsetup.Dispose(); conn.Close(); conn.Dispose(); try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, TimeSpan.FromSeconds(25))) { using (MySqlConnection conn1 = new MySqlConnection("DataSource=**;Database=test;UserID=root;Password=**;PORT=**;logging=true")) { conn1.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn1; for (int i = 0; i < 10; i++) { cmd.CommandText = String.Format("INSERT INTO bug50773 VALUES({0})", i); cmd.ExecuteNonQuery(); } using (MySqlConnection conn2 = new MySqlConnection("DataSource=opensol;Database=test;UserID=root;Password=tonchika;PORT=3306;logging=true")) { conn2.Open(); MySqlCommand cmd2 = new MySqlCommand(); cmd2.Connection = conn2; for (int i = 200; i < 210; i++) { cmd2.CommandText = String.Format("INSERT INTO bug50773 VALUES({0})", i); cmd2.ExecuteNonQuery(); } } } ts.Complete(); ts.Dispose(); } } catch (TransactionAbortedException ex) { Console.Out.WriteLine("TransactionAbortedException Message: " + ex.Message + "\n" + ex.StackTrace); } catch (ApplicationException ex) { Console.Out.WriteLine("ApplicationException Message: " + ex.Message + "\n" + ex.StackTrace); } }