Sunday, August 7, 2011

The timeout period elapsed prior to completion of the operation or the server is not responding.

"The timeout period elapsed prior to completion of the operation or the server is not responding."


Reason:
Whenever you try to retrieve huge amount of data from a database, the query execution time increases, if you have a low connection timeout value set, this error is shown.


Solution:
Set ConnectionTimeout property of the SqlConnection Class to a higher value.


Refer:
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectiontimeout.aspx

4 comments:

Mangesh Kadam said...

How to retrieve large amount of data , e.g. around 1000000 of rows, in very less time? If we set timeout property to a higher value, It will take more time to retrieve huge data hence performance degrades.

Yasser R Shaikh said...

instead you could use ' top 'parameter and say read 100 or 1000 records at once and prepare your data. This however Will be a very dirty way to solve this problem. I'll keep you updated on this.

Mangesh Kadam said...

That's right, but what if we want to generate reports that requires all the data to be show?

Yasser R Shaikh said...

Hi,

you could use

http://code-studio.blogspot.com/2011/04/add-row-columns-to-gridview.html

to add (say 100) rows to your grid created. Once all the rows have been added you can then use that grid for generating reports.

Post a Comment

 

2011 ·Code-Studio by yrus.