What is the use of SqlCommand.CommandTimeout Property ?

Bharathi Cherukuri
Posted by Bharathi Cherukuri under ASP.NET category on | Points: 40 | Views : 2321
This property is used to Get or Set the wait time. This wait time is Get or Set before terminating the attempt to execute a command and generating an error.

//Specify the CommandTimeout property value
SqlCommand CommandObject = 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.

Comments or Responses

Login to post response