MySQL Connector/Net
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: 6.9.9
Syntax
public override int ConnectionTimeout { get; }
Public Overrides ReadOnly Property ConnectionTimeout As Integer Get
public: virtual property int ConnectionTimeout { int get () override; }
abstract ConnectionTimeout : int with get override ConnectionTimeout : int with get
Property Value
Type: Int32Implements
IDbConnectionConnectionTimeoutExceptions
Exception | Condition |
---|---|
ArgumentException | The 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(); }
Public Sub CreateSqlConnection() Dim myConnection As New MySqlConnection() myConnection.ConnectionString = "Persist Security Info=False;Username=user;Password=pass;database=test1;server=localhost;Connect Timeout=30" myConnection.Open() End Sub
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also