• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 708
  • Last Modified:

Timeout Expired Error When Running Long Query and Large Database

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.

Best regards,
Tap
0
tapanan2519
Asked:
tapanan2519
1 Solution
 
PedroCGDCommented:
Dear friend,
I reseolved a similar problem installing cmulative package 7 (after SQL SP2) that fixes several bugs:
http://support.microsoft.com/kb/949095
Helped?
Regards!
Pedro
www.pedrocgd.blogspot.com
0
 
tapanan2519Author Commented:
I have found that the problem is with using SqlAdapter. After setting timeout = 0 for the SqlCommand object, I use it to construct a SqlAdapter object, where it seems the timeout value was not passed to it. So basically, I had to set timeout=0 on the SqlAdapter object, rather than the original of SqlCommand.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now