Home All Groups Group Topic Archive Search About

SqlConnection - Timeout Property is read-only?

Author
18 Apr 2006 4:21 AM
Mark
I'd like to change the SqlConnection timeout propery from the default 15
seconds down to 4 or less.  How can I change it?  I have been unable to find
an example of a connection string that would allow me to override this.

Thanks in advance for your help.

Mark

Author
18 Apr 2006 4:41 AM
William (Bill) Vaughn
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref4/html/P_System_Data_SqlClient_SqlConnection_ConnectionString.htm

It took some time to find it (sadly) but it's there. You can set the
Connection Timeout in the ConnectionString property of the SqlConnection
object. Why do you need to change this? What problem are you trying to
solve?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Mark" <m***@nojunkmail.com> wrote in message
news:utUnl9pYGHA.1196@TK2MSFTNGP03.phx.gbl...
> I'd like to change the SqlConnection timeout propery from the default 15
> seconds down to 4 or less.  How can I change it?  I have been unable to
> find an example of a connection string that would allow me to override
> this.
>
> Thanks in advance for your help.
>
> Mark
>
Author
18 Apr 2006 4:52 AM
Mark
THanks but that's a read-only property of the SqlConnection object.  My hope
is that someone will know the syntax for adding the property directly to the
connection string.

In the event that our app can't find a server in less than 4 seconds, that's
a fantastic sign something is wrong, and there is no sense in letting the
app look around for 15 seconds if it can't find it in the first 4 or less.

Thanks again.

Mark

Show quote
"William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
news:uVHnSJqYGHA.3448@TK2MSFTNGP04.phx.gbl...
> ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref4/html/P_System_Data_SqlClient_SqlConnection_ConnectionString.htm
>
> It took some time to find it (sadly) but it's there. You can set the
> Connection Timeout in the ConnectionString property of the SqlConnection
> object. Why do you need to change this? What problem are you trying to
> solve?
>
> --
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> __________________________________
>
> "Mark" <m***@nojunkmail.com> wrote in message
> news:utUnl9pYGHA.1196@TK2MSFTNGP03.phx.gbl...
>> I'd like to change the SqlConnection timeout propery from the default 15
>> seconds down to 4 or less.  How can I change it?  I have been unable to
>> find an example of a connection string that would allow me to override
>> this.
>>
>> Thanks in advance for your help.
>>
>> Mark
>>
>
>
Author
18 Apr 2006 12:12 PM
Paul Clement
On Mon, 17 Apr 2006 23:52:21 -0500, "Mark" <m***@nojunkmail.com> wrote:

¤ THanks but that's a read-only property of the SqlConnection object.  My hope
¤ is that someone will know the syntax for adding the property directly to the
¤ connection string.
¤
¤ In the event that our app can't find a server in less than 4 seconds, that's
¤ a fantastic sign something is wrong, and there is no sense in letting the
¤ app look around for 15 seconds if it can't find it in the first 4 or less.
¤

Try either Connect Timeout or Connection Timeout.


Paul
~~~~
Microsoft MVP (Visual Basic)
Author
18 Apr 2006 6:01 PM
Mark
Both you and Bill claim that the Connection timeout property can be written
to.  Looking at VS.NET 2003 class library documentation, I find the
following:

SqlConnection Properties:
ConnectionTimeout Property:
Gets the time to wait while trying to establish a connection before
terminating the attempt and generating an error.

Those properties that are read/write are listed as "Gets or Sets blah blah
blah."

Am I missing something here?  Thanks again.

Mark

Show quote
"Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message
news:spl942thjgb720b6862jcmrp6jgmqfm11a@4ax.com...
> On Mon, 17 Apr 2006 23:52:21 -0500, "Mark" <m***@nojunkmail.com> wrote:
>
> ¤ THanks but that's a read-only property of the SqlConnection object.  My
> hope
> ¤ is that someone will know the syntax for adding the property directly to
> the
> ¤ connection string.
> ¤
> ¤ In the event that our app can't find a server in less than 4 seconds,
> that's
> ¤ a fantastic sign something is wrong, and there is no sense in letting
> the
> ¤ app look around for 15 seconds if it can't find it in the first 4 or
> less.
> ¤
>
> Try either Connect Timeout or Connection Timeout.
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
Author
18 Apr 2006 6:49 PM
Paul Clement
On Tue, 18 Apr 2006 13:01:36 -0500, "Mark" <m***@nojunkmail.com> wrote:

¤ Both you and Bill claim that the Connection timeout property can be written
¤ to.  Looking at VS.NET 2003 class library documentation, I find the
¤ following:
¤
¤ SqlConnection Properties:
¤ ConnectionTimeout Property:
¤ Gets the time to wait while trying to establish a connection before
¤ terminating the attempt and generating an error.
¤
¤ Those properties that are read/write are listed as "Gets or Sets blah blah
¤ blah."
¤
¤ Am I missing something here?  Thanks again.

I think so. ;-)

Below is an example for SQL Express that uses the "Connection Timeout" argument:

Server=.\\SQLEXPRESS ;Integrated Security=SSPI;Connection Timeout=5


Paul
~~~~
Microsoft MVP (Visual Basic)
Author
18 Apr 2006 7:01 PM
Mark
That's what I was looking for.  Thank you.

Mark

Show quote
"Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message
news:umca42dvg0hv102cgcqe9kpjuiu9ho0fvt@4ax.com...
> On Tue, 18 Apr 2006 13:01:36 -0500, "Mark" <m***@nojunkmail.com> wrote:
>
> ¤ Both you and Bill claim that the Connection timeout property can be
> written
> ¤ to.  Looking at VS.NET 2003 class library documentation, I find the
> ¤ following:
> ¤
> ¤ SqlConnection Properties:
> ¤ ConnectionTimeout Property:
> ¤ Gets the time to wait while trying to establish a connection before
> ¤ terminating the attempt and generating an error.
> ¤
> ¤ Those properties that are read/write are listed as "Gets or Sets blah
> blah
> ¤ blah."
> ¤
> ¤ Am I missing something here?  Thanks again.
>
> I think so. ;-)
>
> Below is an example for SQL Express that uses the "Connection Timeout"
> argument:
>
> Server=.\\SQLEXPRESS ;Integrated Security=SSPI;Connection Timeout=5
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
Author
18 Apr 2006 7:42 PM
William (Bill) Vaughn
NO WE DON'T. Both Paul and I say it must be changed via the
ConnectionString. This is VERY basic and we assumed (apparently incorrectly)
that you understand when we talk about a ConnectionString that we mean you
need to set the ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Mark" <m***@nojunkmail.com> wrote in message
news:%23cN0DIxYGHA.4144@TK2MSFTNGP04.phx.gbl...
> Both you and Bill claim that the Connection timeout property can be
> written to.  Looking at VS.NET 2003 class library documentation, I find
> the following:
>
> SqlConnection Properties:
> ConnectionTimeout Property:
> Gets the time to wait while trying to establish a connection before
> terminating the attempt and generating an error.
>
> Those properties that are read/write are listed as "Gets or Sets blah blah
> blah."
>
> Am I missing something here?  Thanks again.
>
> Mark
>
> "Paul Clement" <UseAdddressAtEndofMess***@swspectrum.com> wrote in message
> news:spl942thjgb720b6862jcmrp6jgmqfm11a@4ax.com...
>> On Mon, 17 Apr 2006 23:52:21 -0500, "Mark" <m***@nojunkmail.com> wrote:
>>
>> ¤ THanks but that's a read-only property of the SqlConnection object.  My
>> hope
>> ¤ is that someone will know the syntax for adding the property directly
>> to the
>> ¤ connection string.
>> ¤
>> ¤ In the event that our app can't find a server in less than 4 seconds,
>> that's
>> ¤ a fantastic sign something is wrong, and there is no sense in letting
>> the
>> ¤ app look around for 15 seconds if it can't find it in the first 4 or
>> less.
>> ¤
>>
>> Try either Connect Timeout or Connection Timeout.
>>
>>
>> Paul
>> ~~~~
>> Microsoft MVP (Visual Basic)
>
>
Author
18 Apr 2006 4:46 PM
William (Bill) Vaughn
Ah, I pointed to the ConnectionString property which is NOT read-only. You
need to set the Connection Timeout key in the ConnectionString prior to
opening the Connection to change the timeout.


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

Show quote
"Mark" <m***@nojunkmail.com> wrote in message
news:ODHXCPqYGHA.1016@TK2MSFTNGP03.phx.gbl...
> THanks but that's a read-only property of the SqlConnection object.  My
> hope is that someone will know the syntax for adding the property directly
> to the connection string.
>
> In the event that our app can't find a server in less than 4 seconds,
> that's a fantastic sign something is wrong, and there is no sense in
> letting the app look around for 15 seconds if it can't find it in the
> first 4 or less.
>
> Thanks again.
>
> Mark
>
> "William (Bill) Vaughn" <billvaRemoveT***@nwlink.com> wrote in message
> news:uVHnSJqYGHA.3448@TK2MSFTNGP04.phx.gbl...
>> ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref4/html/P_System_Data_SqlClient_SqlConnection_ConnectionString.htm
>>
>> It took some time to find it (sadly) but it's there. You can set the
>> Connection Timeout in the ConnectionString property of the SqlConnection
>> object. Why do you need to change this? What problem are you trying to
>> solve?
>>
>> --
>> ____________________________________
>> William (Bill) Vaughn
>> Author, Mentor, Consultant
>> Microsoft MVP
>> INETA Speaker
>> www.betav.com/blog/billva
>> www.betav.com
>> Please reply only to the newsgroup so that others can benefit.
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> __________________________________
>>
>> "Mark" <m***@nojunkmail.com> wrote in message
>> news:utUnl9pYGHA.1196@TK2MSFTNGP03.phx.gbl...
>>> I'd like to change the SqlConnection timeout propery from the default 15
>>> seconds down to 4 or less.  How can I change it?  I have been unable to
>>> find an example of a connection string that would allow me to override
>>> this.
>>>
>>> Thanks in advance for your help.
>>>
>>> Mark
>>>
>>
>>
>
>

AddThis Social Bookmark Button