asp.net.ph

IDbCommand.CommandTimeout Property

System.Data Namespace   IDbCommand Class


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

Syntax


Script IDbCommand.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.

Exceptions


Exception Type Condition
ArgumentException 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 creates an instance of the derived SqlCommand class, and sets some of its properties.

void setSqlCommand ( ) {
   SqlCommand  myCmd = new SqlCommand ( );
   myCmd.CommandText = "SELECT * FROM Categories ORDER BY CategoryID";
   myCmd.CommandTimeout = 15;
}
  C# VB

See Also

IDbCommand Members   CommandText   Connection   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