Re: Connection Timeout



Andrew J. Kelly wrote:
I don't see the distinction for this. It is just a property (CommandTimeOut) that you set for the connection. It should not matter what the client or the server is or what they do.


The article he pointed you to does indeed describe how to use the ConnectionTimeout property of the ADODB.Connection object, which is similar to what you want.

If you are using the SqlConnection object on .NET 2.0 you'll notice that the ConnectionTimeout property is readonly. What you need to do is include the connection timeout in the connection string.

"Data Source=SERVERNAME;Initial Catalog=DBNAME;Integrated Security=SSPI;Connect Timeout=5"

which will give you a 5 second timeout on the connection.


Arild
.



Relevant Pages


Loading