Gets or sets the time to wait while establishing a connection before terminating the attempt and generating an error.
[Visual Basic] Public Property ConnectionTimeout As Integer [C#] public int ConnectionTimeout {get; set;} [C++] public: __property int get_ConnectionTimeout(); public: __property void set_ConnectionTimeout(int); [JScript] public function get ConnectionTimeout() : int; public function set ConnectionTimeout(int);
The time (in seconds) to wait for a connection to open. The default value is 15 seconds.
Exception Type | Condition |
---|---|
InvalidConnectionTimeout | The value set is less than 0. |
OpenConnectionPropertySet | The connection is Open. Close the connection. |
A value of 0 indicates no limit (i.e. the connection will wait indefinitely). The ConnectionTimeout property overwrites the cooresponding property within the connection string.
Note This property is read-only while the connection is open.
The following example shows how to create a connection and set many of its properties.
ADOConnection Class | ADOConnection Members | System.Data.ADO Namespace | ConnectionString | Database | IsolationLevel | DataSource | UserID | Password