im using this connection string:
-
Con = New OleDb.OleDbConnection("Provider=sqloledb;Data Source=Datadiss3;Initial Catalog= " & Database & ";" & "User ID=username;Password=password; connect timeout=0")
-
and i get error connection timed out.
Why is the connect timeout=0 not working?
Or can any one suggest anything?
Thanks
James
hi james,
if you wish to use Connection Timeout in your string then keep in mind the following.....
You have to set Timeout settings at three level. and these all will work together.
First:
In
SQL Server enterprise manager, in database property set
query time out to 0, It's default vaule is 600.
Second:
In your connection string add "Connection Timeout = 0"
Third:
When you executing your stored procedure or query, that time you also need to set
SqlCommand's CommandTimeout to 0.
Ex. : cmdExecute.CommandTimeout = 0;
and keep in mind Connection timeout is---->
The length of time (in seconds) to wait for a connection to the server before terminating the attempt and generating an error.its default value is 15. A value of 0 indicates no limit, and
should be avoided in a ConnectionString, because an attempt to connect will
wait indefinitely.