asp.net.ph

OleDbCommand.CommandTimeout Property

System.Data.OleDb Namespace   OleDbCommand Class


Sets or retrieves the wait time before terminating an attempt to execute a command and generating an error.

Syntax


Script OleDbCommand.CommandTimeout [ = intTimeout ]

Property Value


intTimeout The time ( in seconds ) to wait for the command to execute.

The property is read/write with a default value of 30.

Implements

IDbCommand.CommandTimeout

Exceptions


Exception Type Condition
ArgumentException Occurs when the property value assigned is less than 0.

Remarks

A value of 0 indicates no limit, and should be avoided in a CommandTimeout because an attempt to execute a command will wait indefinitely.

Example

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;
}
  C# VB

See Also

OleDbCommand Members   Connection   CommandText   CommandType Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph