แก้ไข

แชร์ผ่าน


OdbcConnection.ConnectionTimeout Property

Definition

Gets or sets the time to wait (in seconds) while trying to establish a connection before terminating the attempt and generating an error.

public:
 property int ConnectionTimeout { int get(); void set(int value); };
public int ConnectionTimeout { get; set; }
member this.ConnectionTimeout : int with get, set
Public Property ConnectionTimeout As Integer

Property Value

The time in seconds to wait for a connection to open. The default value is 15 seconds.

Exceptions

The value set is less than 0.

Remarks

Unlike the .NET Framework data providers for SQL Server and OLE DB, the .NET Framework Data Provider for ODBC does not support setting this property as a connection string value, because it is not a valid ODBC connection keyword. To specify a connection time-out, set the ConnectionTimeout property before calling Open. This is equivalent to setting the ODBC SQLSetConnectAttr SQL_ATTR_LOGIN_TIMOUT attribute.

Applies to

See also