Timeout expired (Command TimeOut Property............)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Question123
    New Member
    • Feb 2008
    • 41

    Timeout expired (Command TimeOut Property............)

    Hi
    I am calling one sp from .net code. That sp performs lotof database operations.

    That sp executes sometime in just 30 sec and sometime it takes more than 1000sec .

    so what would be best solution so that sp executes successfully every time. without giving error--

    "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    There is probably a value in your connection string that can specify a command timeout. Connectionstrin gs.com is a great resource to find out.

    Comment

    • balame2004
      New Member
      • Mar 2008
      • 142

      #3
      Set connection timeout to one hour. So it will wait until your SP is fully completed.

      Consider the follwoing connection string:

      SqlConnection con=new SqlConnection(" Server=www.synf g.com;database= synfgdb;user name=sa;passwor d=sa;timeout=36 00");

      Comment

      • Question123
        New Member
        • Feb 2008
        • 41

        #4
        Originally posted by balame2004
        Set connection timeout to one hour. So it will wait until your SP is fully completed.

        Consider the follwoing connection string:

        SqlConnection con=new SqlConnection(" Server=www.synf g.com;database= synfgdb;user name=sa;passwor d=sa;timeout=36 00");
        Thanks for the reply

        But as i have told sometimes it executes in just 10sec.So if it executes in 10sec is it wait upto 1 hr if i set connection timeout to 1hr. or proceed as it finished execution of sp.

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          Originally posted by Question123
          Thanks for the reply

          But as i have told sometimes it executes in just 10sec.So if it executes in 10sec is it wait upto 1 hr if i set connection timeout to 1hr. or proceed as it finished execution of sp.
          The timeout just means that it will wait that long for a response. It doesn't specify a forced connection time or anything.

          Comment

          • Question123
            New Member
            • Feb 2008
            • 41

            #6
            Originally posted by insertAlias
            The timeout just means that it will wait that long for a response. It doesn't specify a forced connection time or anything.
            Thanks for reply .

            Comment

            • Shashi Sadasivan
              Recognized Expert Top Contributor
              • Aug 2007
              • 1435

              #7
              Be aware that there is also another coonectiontime property in the sql command object which means how long to wait for the command to be executed

              The connection string timeout specifies how long the application should stay alive to recieve a response from the server when connected.

              Comment

              • Question123
                New Member
                • Feb 2008
                • 41

                #8
                Originally posted by Shashi Sadasivan
                Be aware that there is also another coonectiontime property in the sql command object which means how long to wait for the command to be executed

                The connection string timeout specifies how long the application should stay alive to recieve a response from the server when connected.

                Hello if i set sql command object timeout propery to 3600sec .
                And if sp executes in 10sec successfully it will wait or proceed.??

                Comment

                • Curtis Rutland
                  Recognized Expert Specialist
                  • Apr 2008
                  • 3264

                  #9
                  Originally posted by Question123
                  Hello if i set sql command object timeout propery to 3600sec .
                  And if sp executes in 10sec successfully it will wait or proceed.??
                  I already told you, that's just how long it will wait for a response. If a command finishes sooner, its done. If it takes longer than the time you allocate, it throws an exception.

                  Comment

                  Working...