Hello everyone,

I'm using NET 2.0 developing in C# connecting to a Mysql database with ADO.net (MySQL Connector/Net -- Mysql.data.MySqlClient). I want to use the new TransactionScope methods to control my transactions, but I'm not having much luck.

Can anyone tell me why the following code won't rollback? I thought all i had to do was NOT call complete().

-Dan



using (TransactionScope ts = new TransactionScope())
{
string connectionString = ConfigurationManager.AppSettings["DATABASECONNECTIONSTRING"];
MySqlConnection mySqlConnection = new MySqlConnection(connectionString);
mySqlConnection.Open();
MySqlCommand mySqlCommand = new MySqlCommand();
mySqlCommand.Connection = mySqlConnection;
mySqlCommand.CommandText = @"INSERT INTO tablename VALUES
('one', 'two', 'three');";
mySqlCommand.ExecuteNonQuery();
mySqlConnection.Close();

throw new Exception("why won't you roll back?");

}