Click to See Complete Forum and Search --> : Timeout expired
adamshao
October 18th, 2002, 08:20 PM
I tried to call a stored procedure in SQL server, and it returned "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
". The source error is at:
myReader = aCommand.ExecuteReader();
The SP works on a SQL Query Analyzer, but takes more than 2 minutes. Some other SPs which take less time all work well in my ASP.Net application. Is there any parameter that I should set to lengthen the timeout time? I tried the connectionstring, but it doesn't work.
seshuKumarg
October 20th, 2002, 05:04 AM
use Connect timeout property.
For ex:
The connection string would be like the following string:
strCnn="server =local;database=pubs;uid=sa;pwd=;
connect timeout=60"
Seshu
DaddyGweedo
March 11th, 2003, 10:46 AM
I am having the same problem. However I have changed the timeout property of the connection string with no change. I run the same query in SQL Query Analyzer and it takes about 45 seconds, yet if I set the time out to 60 or even 240. I still don't get any response.
Also, I set the timeout to 1 and I run queries that I know will return results and they still work, even though they take 20 seconds to run.
So my question is;
Is the timeout property even used???
DG
:mad:
DaddyGweedo
March 11th, 2003, 11:22 AM
Here is what solved my problem.
I set the connection timeout, but I was not setting the command timeout.
So if you have this problem be sure to set it as below:
sqlCommand1.CommandTimeout = 60
Very simple...
:rolleyes:
gaurav_bindlish
May 2nd, 2003, 05:37 PM
Hey guys, u saved my day too... But i don't understand this, why don't I have to set this property at all places. I have other queries running for more time than this as well.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.