System.Data.OleDb Namespace OleDbCommand Class
Sets or retrieves the wait time before terminating an attempt to execute a command and generating an error.
Script |
OleDbCommand.CommandTimeout [ = intTimeout ] |
intTimeout |
The time ( in seconds ) to wait for the command to execute. |
The property is read/write with a default value of 30.
IDbCommand.CommandTimeout
Exception Type |
Condition |
ArgumentException |
Occurs when the property value assigned is less than 0. |
A value of 0 indicates no limit, and should be avoided in a CommandTimeout because an attempt to execute a command will wait indefinitely.
The following example illustrates using the CommandTimeout property.
void CommandTimeoutDemo ( ) {
string query = "SELECT * FROM Categories ORDER BY CategoryID";
OleDbCommand myCommand = new OleDbCommand ( query );
myCommand.CommandTimeout = 20;
}
Public Sub CommandTimeoutDemo ( )
Dim query As String = "SELECT * FROM Categories ORDER BY CategoryID"
Dim myCommand As New OleDbCommand ( query )
myCommand.CommandTimeout = 20
End Sub |
|
C# |
VB |
OleDbCommand Members Connection CommandText CommandType