Search This Blog

Friday, August 10, 2012

SqlCommand CommandTimeout Property

C# > Data > SqlCommand > CommandTimeout

The time in seconds to wait (timeout) for the command to execute. The default is 30 seconds.

A value of 0 indicates no limit and will wait indefinitely until command is executed.

Example:

SqlConnection con = new SqlConnection("connString");
SqlCommand com = new SqlCommand("exec your_stored_procedure", con);
com.CommandTimeout = 60;