작업으로 표시된 별도의 스레드에서 쿼리를 실행하는 MySQL 연결이 있습니다.스레드 작업 취소 중
취소 토큰을 통해 사용자가 단추를 클릭 할 때이 스레드를 중지합니다.
내 문제는 오류가 말을되게되고 있다는 않습니다 :
버튼을 누른에cancellationToken = new CancellationTokenSource();
await Task.Run(() =>
{
using (MySqlConnection connection = new MySqlConnection(sourceDatabaseConnectionString))
{
connection.Open();
using (MySqlCommand command = new MySqlCommand(sql, connection))
{
command.CommandTimeout = 0;
command.Parameters.AddWithValue("@month", datePicker.Value.Month);
command.Parameters.AddWithValue("@year", datePicker.Value.Year);
int rows = command.ExecuteNonQuery();
}
}
}
}, cancellationToken.Token);
내가하려고하면, 내가 cancellationToken.Cancel();
전화 해요 : Lock wait timeout exceeded; try restarting transaction
이 내 코드입니다 작업을 시작하여 SQL 문을 다시 실행하려면 위에 표시된 오류 메시지가 나타납니다. 무엇 때문에 그 원인이 될 수 있습니까?
내가 가장 intresting 부분이 "// 쿼리 실행"코멘트에 있다고 내기. – athabaska
@athabaska - 편집 – desperate
http://stackoverflow.com/questions/5836623/getting-lock-wait-timeout-exceeded-try-restarting- transaction-even-though-im – vtortola