CommandTimeout

This property specifies the minimum number of seconds that the command is allowed to execute before terminating with an exception.

Declaration

// C#
public override int CommandTimeout {get; set;}

Property Value

int

Implements

IDbCommand.CommandTimeout

Exceptions

InvalidArgument - The specified value is less than 0.

Remarks

Default is 0 seconds, which enforces no time limit.

When the specified timeout value expires before a command execution finishes, the command attempts to cancel. If cancellation is successful, an exception is thrown with the message of ORA-01013: user requested cancel of current operation. Other possible exceptions thrown after a command timeout expiration occurs include ORA-00936 and ORA-00604. If the command executed in time without any errors, no exceptions are thrown.

In a situation where multiple OracleCommand objects use the same connection, the timeout expiration on one of the OracleCommand objects may terminate any of the executions on the single connection. To make the timeout expiration of a OracleCommand cancel only its own command execution, simply use one OracleCommand for each connection if that OracleCommand sets the CommandTimeout property to a value greater than 0.