How do you interupt a long-running database query?

  • Thread starter Thread starter Gershon
  • Start date Start date
G

Gershon

I have an ASP.NET/C# web application running against a SQL Server
database using ADO.NET. Whenever there is a long-running database
query, the web application hangs until the database query is complete.
Even clicking the browser's stop button and clicking on other links
within the web application fails. The only thing the user can do is
close the browser and open up a new browser window. Is there any other
way for a user to interupt a database query?
I am not using a Dispose method and thought that might be the
problem. However, there is no "unmanaged" code being used that I am
aware of.
 
You might try having the database operation happen in a new Thread.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
I believe you can set the timeout smaller and abort using a try/catch...
which you should be doing anyway whenever you make a database call. I'm new
to ASP.NET however. ;)

Also, I'd be concerned about the database hanging like that. Is there a lot
of network traffic? Optimize your SQL Server? I'm afraid to ask, but you ARE
using stored procedures for all your queries I hope. ;)

-Max
 
Back
Top