Dela via


SqlConnection.CommandTimeout Property

Definition

Gets the default wait time (in seconds) before terminating the attempt to execute a command and generating an error. The default is 30 seconds.

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

Property Value

The time in seconds to wait for the command to execute. The default is 30 seconds.

Remarks

You can set the default wait time by using the Command Timeout keyword in the connection string. A value of 0 indicates no limit (an attempt to execute a command will wait indefinitely).

Applies to