在下面的代码中command.EndExecuteNonQuery
抛出
异步操作已经完成。
EndExecuteNonQuery
结束异步操作。MSDN 状态用于EndExecuteNonQuery
正确完成操作。有什么想法吗?
using (var command = new SqlCommand("EXEC SP", connection))
{
AsyncCallback callback = HandleCallBack;
command.BeginExecuteNonQuery(callback, command);
}
private void HandleCallBack(IAsyncResult result)
{
try
{
using (var command = (SqlCommand)result.AsyncState)
{
command.EndExecuteNonQuery(result);
}
}
catch (Exception ex)
{
}
}