ConnectionTimeout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BVM

    ConnectionTimeout

    Hi:

    Do you know how to change Connection timeout time? By default it's 15s, Now I want to change it to 30s. However SqlConnection.C onnectionTimeou t is read only. What should I do?

    Also if the SQL query is to long and need several minutes to finish, is there a way to make timeout time longer?

    Thanks,

    Dennis Huang

  • Greg Ewing [MVP]

    #2
    Re: ConnectionTimeo ut

    Dennis, you can change the Connection Timeout property in your Connection
    string. Just set tthe value to whatever you want it to be. That will then
    change the ConnectionTimeo ut property on your SqlConnection object.

    --
    Greg Ewing [MVP]
    Accomplish Your Mission with Better IT | IT support for nonprofits. You deserve peace of mind. National and remote outsourced nonprofit IT.


    "BVM" <DennisH@TBH.co m.au> wrote in message
    news:O$WIZ67hDH A.1692@TK2MSFTN GP10.phx.gbl...
    Hi:

    Do you know how to change Connection timeout time? By default it's 15s, Now
    I want to change it to 30s. However SqlConnection.C onnectionTimeou t is read
    only. What should I do?

    Also if the SQL query is to long and need several minutes to finish, is
    there a way to make timeout time longer?

    Thanks,

    Dennis Huang


    Comment

    • Manoj G [MVP]

      #3
      Re: ConnectionTimeo ut

      Hi,

      In your case, you should consider setting the CommandTimeout property of the command object instead. ConnectionTimeo ut is a timeout value for establishing a connection, not executing commands.
      BTW, to you can set the connection timeout as a part of the connection string.
      For eg: "Database=north wind;server=myS erver;Connect Timeout=30;Inte grated Security=SSPI"

      --
      HTH,
      Manoj G [.NET MVP]


      "BVM" <DennisH@TBH.co m.au> wrote in message news:O$WIZ67hDH A.1692@TK2MSFTN GP10.phx.gbl...
      Hi:

      Do you know how to change Connection timeout time? By default it's 15s, Now I want to change it to 30s. However SqlConnection.C onnectionTimeou t is read only. What should I do?

      Also if the SQL query is to long and need several minutes to finish, is there a way to make timeout time longer?

      Thanks,

      Dennis Huang

      Comment

      • Greg Low \(MVP\)

        #4
        Re: ConnectionTimeo ut

        And don't set it to zero (ie unlimited). Unfortunately, it currently really means ZERO.

        HTH,

        --
        Greg Low (MVP)
        MSDE Manager SQL Tools


        "Manoj G [MVP]" <manuthegreat@h otmail.com> wrote in message news:uqdu0KDiDH A.1688@TK2MSFTN GP10.phx.gbl...
        Hi,

        In your case, you should consider setting the CommandTimeout property of the command object instead. ConnectionTimeo ut is a timeout value for establishing a connection, not executing commands.
        BTW, to you can set the connection timeout as a part of the connection string.
        For eg: "Database=north wind;server=myS erver;Connect Timeout=30;Inte grated Security=SSPI"

        --
        HTH,
        Manoj G [.NET MVP]


        "BVM" <DennisH@TBH.co m.au> wrote in message news:O$WIZ67hDH A.1692@TK2MSFTN GP10.phx.gbl...
        Hi:

        Do you know how to change Connection timeout time? By default it's 15s, Now I want to change it to 30s. However SqlConnection.C onnectionTimeou t is read only. What should I do?

        Also if the SQL query is to long and need several minutes to finish, is there a way to make timeout time longer?

        Thanks,

        Dennis Huang

        Comment

        Working...