Gets or sets the wait time before terminating the attempt to connect and generating an error.
[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 value is 30 seconds.
Exception Type | Condition |
---|---|
InvalidCommandTimeout | The property is assigned a value less than 0. |
Use this property only after the connection is open.
The following example creates a SQLCommand and sets some of its properties.
SQLCommand Class | SQLCommand Members | System.Data.SQL Namespace | CommandText | ActiveConnection | CommandType | CommandBehavior | DefaultCommandTimeout