Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Code Repository
   

Keep a SQL query from timing out



 
Return

Keep a SQL query from timing out

Sometimes a large sql query will time out before it can complete. Here's how to keep that from happening:

(If your query is very large you may want to show the person using the application a splash page while the query executes. If you do check out the "Boost web performance with multithreading" entry here in the code library.)

Using a SqlCommand object set the command timeout property in seconds (max of 1800).
  1. SqlCommand.CommandTimeout = 1800


In the web.config file set the httpRuntime parameter execution timeout in seconds (max of 3600).
  1. <system.web>
  2. ...
  3. <httpRuntime executionTimeout="3600" />
  4. ...
  5. </system.web>


Return
Microsoft Certified Professional   © 2018 Fortunate.  All rights reserved.
contact: justin@aboutfortunate.com