Gets or sets the wait time before terminating the attempt to execute a command, or the execution of a command. An error is generated after termination.
[Visual Basic]
Public Property CommandTimeout As Integer
[C#]
public int CommandTimeout {get; set;}
[C++]
public: __property int get_CommandTimeout();
public: __property void set_CommandTimeout(int);
[JScript]
public function get CommandTimeout() : int;
public function set CommandTimeout(int);
The time (in seconds) to wait for the command to execute. The default is 30 seconds.
Exception type | Condition |
---|---|
ArgumentException | The property value assigned is less than 0. |
A value of zero (0) specifies no limit to the wait time, rather than no wait time, and therefore should be avoided.
[Visual Basic, C#] The following example creates a DB2Command and sets some of its properties.
[Visual Basic]
Public Sub CreateMyDB2Command()
Dim mySelectQuery As String = "SELECT * FROM EMPLOYEE ORDER BY EMPNO"
Dim myCommand As New DB2Command(mySelectQuery)
myCommand.CommandTimeout = 20
End Sub
[C#]
public void CreateMyDB2Command()
{
string mySelectQuery = "SELECT * FROM EMPLOYEE ORDER BY EMPNO";
DB2Command myCommand = new DB2Command(mySelectQuery);
myCommand.CommandTimeout = 20;
}