problem withAsync SqlComman
Posted
by Alibm
on Stack Overflow
See other posts from Stack Overflow
or by Alibm
Published on 2010-04-04T07:44:57Z
Indexed on
2010/04/04
7:53 UTC
Read the original article
Hit count: 305
I have problem with Timeout, when I run a command through app, a timeout exception is thrown, but when I run i directly in sql there is no timeout exception!
my SP take about 11 min when I run it directly. for solving this issue, I found below code here, but I doesn't work properly! Immediately after beginExecute, IAsyncResult.iscomplete become true !!!!
where is the problem ?
IAsyncResult result = command.BeginExecuteNonQuery();
int count = 0;
while (!result.IsCompleted)
{
Console.WriteLine("Waiting ({0})", count++);
System.Threading.Thread.Sleep(1000);
}
Console.WriteLine("Command complete. Affected {0} rows.",
command.EndExecuteNonQuery(result));
regards
© Stack Overflow or respective owner