Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Connection Timeout

Status
Not open for further replies.

James1981

Programmer
Nov 2, 2002
76
0
0
US
Hi,

I have a Stored Procedure that takes a very long time to run, I'm getting a problem that I think is due to the connection to the DB timing out. Is there a default amount of time after which the connection times out if no result is given from the SQL server?

If so, how can I change this default value? My connection string is as follows:

Code:
Private Const SQL_CONNECTION_STRING As String = _
                "Server=IREA1SQLP100;" & _
                "DataBase=dsw_ecfilter_mk_delta;" & _
                "Uid=ecfilter_mk_delta_user;" & _
                "Pwd=er5t6*3B"
Dim scnnDelta As New SqlConnection(SQL_CONNECTION_STRING)

Thanks,

James
 
If the DB times out that error will be returned to the caller. Are you getting an error?
 
Hi,

In VB6 the timeout was a property of the connection, in VB.net it is a property of the command object: CommandTimeout. the default value is 30 seconds.
-----------------------------
Dim Comm As New SqlCommand(YourTimeConsumingSQL, Conn)
Comm.CommandTimeout = 5 * 60 ' set the timeout to 5 minutes
----------------------------------------

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top