Topaz Filer: if you use e-mail for business, we can save you money and decrease your risk.
Connection Timeout
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.adonet.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

A.M
GOOD ANSWER
Hi,

Can I define connection's timeout in SqlConnection's connection string ?

Thanks,
Alan

Reply to this message...
Vote that this is a GOOD answer... (3 votes from other users already)
 
 
    
William \(Bill\) Vaughn
GOOD ANSWER
You mean besides using the ConnectionString "Connection timeout=xx;" option?

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
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.
__________________________________

"A.M" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
    
Warren Patterson
GOOD ANSWER
server=myServer;uid=myUser;pwd=myPassword;database=myDatabase;Connect
Timeout=60

Connect Timeout=60

"William (Bill) Vaughn" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> You mean besides using the ConnectionString "Connection timeout=xx;"
option?
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (5 votes from other users already)
 
 
    
Angel Saenz-Badillos[MS] (VIP)
GOOD ANSWER
Be aware that the Connection Timeout value is "at least" x instead of "at
most" x seconds. We will not automatically abort the connection attempt when
the timeout is reached. Think of a loop:

Try to connect loop:
If time is greater than Connection Timeout exit.
call win32 api; //this can take some time.
End try to connect loop.

In this scenario your worst case connection timeout will be Connection
Timeout -1 + time it takes to do win32 api call. In some cases, like a
server that is down this can add up to a significant chunk of time.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/

"Warren Patterson" <Click here to reveal e-mail address> wrote in message
news:#Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer... (1 vote from another user already)
 
 
 
System.Data.SqlClient.SqlConnection




Ad
BootFX
Reliable and powerful .NET application framework.
Recession Busting Bespoke Software
Get through the recession by investing in bespoke software to decrease costs and create commercial opportunities.
Other DN247 Network Sites
.NET 247
SQL Server Wins
Old Skool Developer
 
Copyright © AMX Software Ltd 2008-2009. Portions copyright © Matthew Baxter-Reynolds 2001-2009. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - .NET 247 is a member of the DN247 Network - 4.0.30129.1734