I am using MySQL 5.0.27 and am trying to get the transaction to work. I followed this tutorial:
And still can not get it to work. The table I am trying to update is InDodbe and set AutoComment = 0 ', but it does not appear to be anything .... I have written the following code:
public full transaction update () {MySqlConnection connection = new MySqlConnection (connStr); Connection.Open (); MySqCommand command = connection.CreateCommand (); MySqlTransaction Trans; Trans = connection.BeginTransaction (); order. Connection = connection; order. Transport = trance; Try {command.CommandText = "SET autocommit = 0"; Command.executeNonQuery (); Command.CommandText = "Update TBL.Rack_Long RL SET rl.lang_code = 'N-U' WHERE rl.recording = 123456"; Command.executeNonQuery (); Command.CommandText = "Update TBL.rec_lang rl SET rl.lang_code = en-us WHERE rl.recording = 123456"; Command.executeNonQuery (); Trans.Commit (); } Hold (exception before) {try {trans.Rollback ()); } Hold (MySqlException mse) {log. Terror (MSE); }}} The second command fails because it is missing the surrounding 'N-us'. It should roll back the previous value along with the first question, but it is not . Can you tell me what i am doing ???
MySQLConnector v. 6.3.6.0
MySQL v. 5.0.27
C # VS2010
I had another database open which Showing poor data & gt; & Lt; ... This method works, I did not even need to exit:
command. Commd text = "set autocommment = 0"; Command.executeNonQuery (); So this code works for transactions.
Comments
Post a Comment