Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

SqlConnectionStringBuilder::ConnectTimeout Property

 

Gets or sets the length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

public:
property int ConnectTimeout {
	int get();
	void set(int value);
}

Property Value

Type: System::Int32

The value of the ConnectTimeout property, or 15 seconds if no value has been supplied.

This property corresponds to the "Connect Timeout", "connection timeout", and "timeout" keys within the connection string.

When opening a connection to a Azure SQL Database, set the connection timeout to 30 seconds.

The following example first displays the contents of a connection string that does not specify the "Connect Timeout" value, sets the ConnectTimeout property, and then displays the new connection string.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft