Canceling Async Commands

Published 10 March 06 06:48 PM | despos

I've been giving quite a few presentations lately on ADO.NET async commands and one of the most common questions I take regards the cancellation of pending commands. My answer is invariably, use the Cancel method on the SqlCommand class. One of the attentive guys I had last week pointed out that this is exactly what the MSDN documentation suggests NOT to do.

Next I got back to the excellent Pablo Castro's article where he suggests just to use Cancel.

Who's right? To me, Cancel always worked. However, the doubt that it could work by mere chance on the local host raised. Pablo was kind enough to clarify this point.

The MSDN documentation is outdated as support for cancelling asynchronous commands was added only with the last milestone before shipping .NET 2.0.


PS: This is not much technical, but ... I'll be in Orlando for DevConnections the week of April 1. Is there anybody attending the conference and willing to play some (amateur-like) tennis?

Comments

# Ciaran said on March 10, 2006 04:45 PM:

Dino

Thanks for the link to the article. I had not come across it until you linked to it. However, your link is wrong... the link points to:
http://weblogs.asp.net/despos/archive/2006/03/10/(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/async2.asp

I thought you would like to know.

Cheers,
Ciaran

# Manish said on March 20, 2006 02:05 PM:

Dino:

The link to your article on 'Rearchitect Your Web Applications for ASP.NET 2.0' is not working. Can you please provide with the correct link? Thanks!

Manish

Leave a Comment

(required) 
(required) 
(optional)
(required)