Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 AsyncResult.IsCompleted reporting True before done

Author  Topic 

LJCinTexas
Starting Member

3 Posts

Posted - 2009-05-13 : 10:17:27
Are there any valid reasons why IAsyncResult.IsCompleted would return True BEFORE the SqlCommand's procedure is completed?

I start a lengthy import process asynchronously in VB.Net using:

cmdAsync = New SqlCommand("usp_ImportBatch", dbConn)
asyncResult = cmdAsync.BeginExecuteNonQuery()

and check the status every couple of seconds with:

If asyncResult.IsCompleted Then cmdAsync.EndExecuteNonQuery(asyncResult)

For the first minute or so, it returns False, but then starts returning True, way before the procedure is done.

I also re-coded to use the callback approach, and accordingly, the callback is getting called before it's done. Thanks.
   

- Advertisement -