我使用这种方法将登录列的值增加一:
MySqlConnection connect = new MySqlConnection(connectionStringMySql);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = connect;
cmd.Connection.Open();
string commandLine = null;
commandLine = "UPDATE Users SET logins = (@cur_value := logins) + 1 WHERE id = @id;";
cmd.CommandText = commandLine;
cmd.Parameters.AddWithValue("@id", userId);
cmd.ExecuteNonQuery();
cmd.Connection.Close();
我得到了这个例外:
命令执行期间遇到致命错误。