CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Timeout expired

  1. #1
    Join Date
    Sep 2002
    Location
    Seattle, WA
    Posts
    6

    Timeout expired

    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.

  2. #2
    Join Date
    Aug 2002
    Location
    Hyderabad
    Posts
    13
    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
    Thanks
    seshu kumar g

  3. #3
    Join Date
    Jul 2000
    Posts
    70

    Angry Ignoring the timeout.

    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

  4. #4
    Join Date
    Jul 2000
    Posts
    70

    Answer...

    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:

    Code:
    sqlCommand1.CommandTimeout = 60
    Very simple...


  5. #5
    Join Date
    May 2003
    Posts
    1
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured