Click or drag to resize
MySqlConnectionConnectionTimeout Property
Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.

Namespace:  MySql.Data.MySqlClient
Assembly:  MySql.Data (in MySql.Data.dll) Version: 8.0.19
Syntax
public override int ConnectionTimeout { get; }

Property Value

Type: Int32

Implements

IDbConnectionConnectionTimeout
Exceptions
ExceptionCondition
ArgumentExceptionThe value set is less than 0.
Remarks
A value of 0 indicates no limit, and should be avoided in a ConnectionString because an attempt to connect will wait indefinitely.
Examples
The following example creates a MySqlConnection and sets some of its properties in the connection string.
public void CreateSqlConnection()
{
MySqlConnection myConnection = new MySqlConnection();
myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30";
myConnection.Open();
}
See Also