Share via

IDbCommand.CommandTimeout Property


Gets or sets the wait time (in seconds) before terminating the attempt to execute a command and generating an error.

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

Property Value

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


The property value assigned is less than 0.


The following example creates an instance of a derived class, SqlCommand and sets some of its properties.

public void CreateSqlCommand()
   SqlCommand command = new SqlCommand();
   command.CommandTimeout = 15;
   command.CommandType = CommandType.Text;
Public Sub CreateSqlCommand()
    Dim command As New SqlCommand()
    command.CommandTimeout = 15
    command.CommandType = CommandType.Text
End Sub

Applies to

See also