Saturday, 27 April 2013

What is SqlCommand.CommandTimeout Property used for? | ASP.Net interview questions

CommandTimeout Property is used to Get or set the wait time before terminating the attempt to execute a command and generating an error.
//Specify the CommandTimeout property value
SqlCommandCommandObject = new SqlCommand("StoredProcedureName",ConnectionObject);
//Wait for 10 seconds to execute the Stored procedure
CommandObject.CommandTimeout = 10;
The time is in seconds. The default is 30 seconds.

No comments: