You can do something like
MySqlConnection con = new MySqlConnection( ... );
con.Open();
MySqlTransaction tx = con.BeginTransaction();
MySqlCommand cmd = new MySqlCommand( "", con );
cmd.Transaction = tx;
try
{
cmd.CommandText = "INSERT query insert Data into MySQL DB in Table 1";
cmd.ExecuteNonQuery();
cmd.CommandText = "Update Query update 1 fields value in Table 2";
cmd.ExecuteNonQuery();
tx.Commit();
}
catch( MySqlException e )
{
// TODO: report error?
tx.Rollback();
}
Then if first insert query failed, you catch the error and rollback from there (to abort transaction)
Or if 2nd query fails, again you rollback (to undo changes of first query).
Otherwise commit everything.
Just remember to use Innodb engine for your tables, (otherwise transactions don't work in MyISAM).