I have been getting the infamous 'Timeout Expired' problem with my web application developed using MS .NET and using Microsoft SQL Server 2005. The query is long and the database contains over 800K records further linked with some other tables. The query worked fine when the database contained about 500-600K records (we have a backup of the old database). On 500-600K records, the query takes less than a minute to complete.
Now, I've been browsing the internet for solutions and we did try them. These are:
1. Changing SqlCommand.CommandTimeout and SqlConnection.ConnectionTimeout to 0.
2. Adding 'with (nolock)' to the query.
However, neither of them work. I am in desperate needs for help. Thank you in advance.