Редагувати

Поділитися через


IDbCommand.CommandTimeout Property

Definition

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

public:
 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.

Exceptions

The property value assigned is less than 0.

Examples

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