# Solved: ASP.net error - Timeout Expired



## RogueSpear00 (Jan 18, 2008)

I have a pretty simple page currently that has a SQL Source that's has the following query:

```
SELECT     DialID, company, DBAname, transferred, transferred_date, salesagent, transferred_to
FROM         contact
WHERE     (transferred_date BETWEEN CONVERT(DATETIME, '2009-01-01 00:00:00', 102) AND CONVERT(DATETIME, '2009-01-30 00:00:00', 102))
ORDER BY transferred_date, salesagent
```
When I attempt to load my .aspx page, I get the below error 95% of the time although occassionally it successfully loads.



> Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
> Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
> 
> Exception Details: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
> ...


The database is pretty large, which probably explains some of the time delay - but all my other select statements to this same database with far more narrow results show up much faster.

What can I do to eliminate this problem? Can I rewrite my statement or change a setting to more efficiently work?

Thanks!


----------



## RogueSpear00 (Jan 18, 2008)

Roughly ~:24-:28 seconds for query results, although none of the other queries against the same table (and somewhat more complex) take that long.


----------



## RogueSpear00 (Jan 18, 2008)

*knock knock* Who's there? No one!  

Any help would be appreciated - 

I've tried the following:
Create a view, run the Date Source from there.
Add a Connect Timeout to the ConnectionString.
And several other areas within the code/vb to add a timeout increase.


----------



## pvc_ (Feb 18, 2008)

it might be the conversions that you're doing in the query; try simplifying the query a little bit. You might be able to find some settings for the timeout period in the web.config or the master config file. I dont program in asp.net that often to give you specific details....sorry.


----------



## RogueSpear00 (Jan 18, 2008)

Thanks for the response!

Simplifying the query did nothing unfortunately - nor did adding any type of timeout in the web.config.


----------



## RogueSpear00 (Jan 18, 2008)

I did end up resolving this on my own - since the table was so large, I created a new index including the subset of data I was looking for. Created the index, and voila - .02 response time for query. *yay*


----------

