IDbConnection.ConnectionTimeout IDbConnection.ConnectionTimeout IDbConnection.ConnectionTimeout IDbConnection.ConnectionTimeout Property

定义

获取终止尝试并生成错误之前在尝试建立连接时所等待的时间。Gets the time to wait while trying to establish a connection before terminating the attempt and generating an error.

public:
 property int ConnectionTimeout { int get(); };
public int ConnectionTimeout { get; }
member this.ConnectionTimeout : int
Public ReadOnly Property ConnectionTimeout As Integer

属性值

等待连接打开所需的时间(以秒为单位)。The time (in seconds) to wait for a connection to open. 默认值为 15 秒。The default value is 15 seconds.

注解

如果值为 0, 则表示没有等待时间的限制, 而不是等待时间的限制, 因此应避免ConnectionString在中, 因为这会导致连接尝试无限期等待。A value of 0 indicates no limit to the wait time, rather than no wait time, and should be avoided in a ConnectionString because it would cause the connection attempt to wait indefinitely.

适用于