Reputation: 3844
I tried to set ConnectionTimeout of SqlConnection object (C#). But it is read-only property. Default timeout to establish connection is specified as 15 seconds. I want to increase the timeout to 60 seconds.
Is there any other way to set ConnectionTimeout property?
Upvotes: 0
Views: 1345
Reputation: 77304
You can set the connection timeout in the connection string your pass to the SqlConnection instance.
"Connection Timeout=60"
Upvotes: 2
Reputation: 7601
if it's for one or two query probs then you can set the CommandTimeout property.
cmd.CommandTimeout = Convert.ToInt16(ConfigurationManager.AppSettings["CommandTimeout"].ToString());
Upvotes: 0