I am using an asynchronous process to extract data from a long SQL query. A process calls a stored procedure using a method SqlCommand.BeginExecuteReader().
Sometimes I would like to shut down my process and gracefully terminate any running requests.
After some testing, it seems enough to call SqlConnection.Close(). For good measure, I also explicitly call SqlConnection.Dispose().
When I run the trace through SQL Server Profiler, it looks like the query ends gracefully as I see it SQL:BatchStarting, and then SQL:BatchCompletedafter the call Close().
Can anyone confirm that you want to close the connection?
source
share