xxxxxxxxxx
If you add a Connect timeout=120 to this string, your connection will try for 120
seconds to get opened and then aborts.
Data Source=.;Initial Catalog=TestDB;Trusted_Connection=true;Asynchronous Processing=true;Connection Timeout=120;
xxxxxxxxxx
For each command, you can also specify a timeout - ADO.NET will wait for that
amount of time before cancelling out your query.
You specify that on the sqlCommand object:
using(SqlCommand RetriveOrderCommand = new sqlCommand())
{
RetrieveOrderCommand.CommandTimeout = 150;
}