MySqlCommand ExecuteNonQuery locks
Posted: Wed 16 Jan 2008 11:08
Hello all,
I have just moved from the Mysql .net provider as I need SSL and it appears to work on this version. SoI ported my code to use corelabs MyDirect provider and on the whole it was easy and it works (and so does SSL).
The problem I have though is ExecuteNonQuery when performing an update performs the update, but never returns - it enters a lock/sleep state, which locks the application.
String Sql = "UPDATE Activity SET ";
Sql += "loads of other SQL";
using (MySqlCommand command = new MySqlCommand(Sql, this.Connection))
{
command.Parameters.AddWithValue(":Title", ActivityDetails.Title);
command.Parameters.AddWithValue(":Type", ActivityDetails.Type);
command.Parameters.AddWithValue(":CaseID", ActivityDetails.CaseID);
command.Parameters.AddWithValue(":UserID", ActivityDetails.AssignTo);
command.Parameters.AddWithValue(":ScheduledDate", ActivityDetails.Scheduled);
command.Parameters.AddWithValue(":CompletedDate", ActivityDetails.CompletedDate);
command.Parameters.AddWithValue(":TimeTaken", ActivityDetails.TimeTaken);
command.Parameters.AddWithValue(":Details", ActivityDetails.Details);
command.Parameters.AddWithValue(":Progress", ActivityDetails.Progress);
command.Parameters.AddWithValue(":ModifiedBy", this.UserDetails.UserID);
command.Parameters.AddWithValue(":ActivityID", ActivityDetails.ActivityID);
//this is where it locks...
command.ExecuteNonQuery();
}
The connection is a member variable which gets re-used.
It is a trial version 4.30.24.0.
Thanks
Nick
I have just moved from the Mysql .net provider as I need SSL and it appears to work on this version. SoI ported my code to use corelabs MyDirect provider and on the whole it was easy and it works (and so does SSL).
The problem I have though is ExecuteNonQuery when performing an update performs the update, but never returns - it enters a lock/sleep state, which locks the application.
String Sql = "UPDATE Activity SET ";
Sql += "loads of other SQL";
using (MySqlCommand command = new MySqlCommand(Sql, this.Connection))
{
command.Parameters.AddWithValue(":Title", ActivityDetails.Title);
command.Parameters.AddWithValue(":Type", ActivityDetails.Type);
command.Parameters.AddWithValue(":CaseID", ActivityDetails.CaseID);
command.Parameters.AddWithValue(":UserID", ActivityDetails.AssignTo);
command.Parameters.AddWithValue(":ScheduledDate", ActivityDetails.Scheduled);
command.Parameters.AddWithValue(":CompletedDate", ActivityDetails.CompletedDate);
command.Parameters.AddWithValue(":TimeTaken", ActivityDetails.TimeTaken);
command.Parameters.AddWithValue(":Details", ActivityDetails.Details);
command.Parameters.AddWithValue(":Progress", ActivityDetails.Progress);
command.Parameters.AddWithValue(":ModifiedBy", this.UserDetails.UserID);
command.Parameters.AddWithValue(":ActivityID", ActivityDetails.ActivityID);
//this is where it locks...
command.ExecuteNonQuery();
}
The connection is a member variable which gets re-used.
It is a trial version 4.30.24.0.
Thanks
Nick