Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connection timeout property in connection string ignored

I'm building an app in C#. I'm using a connection string like:

DSN=SomeDataSource; Trusted Connection = yes; Uid=SomeId; pwd=somePwd; Connection Timeout=x

But no matter what value I set as x (Connection Timeout = x), by putting a breakpoint, I can see that my DbConnection object's ConnectionTimeout property always has the default value 15.

Am I missing something here?

Thanks.

like image 938
DJPB Avatar asked Feb 15 '10 12:02

DJPB


1 Answers

The Connection Timeout in the ConnectionString only controls the timeout for the connection. If you need to increase the wait time on your Commands, use the CommandTimeout property of SqlCommand.

like image 164
Neil Knight Avatar answered Oct 22 '22 16:10

Neil Knight