|
-
Nov 24th, 2004, 05:54 AM
#1
Thread Starter
Hyperactive Member
ASP.Net over SQL Server - Connection Timeout
I'm having a problem with my asp.net application deployed over an SQL server back end. Actually it works fine but then at some point in time, for some reason, when retrieving data from any given table I get an error message of connection timeout expired.
Actually I have tried to empty syslogs, restart SQL server and it would eventually turn out to work again. But I dont have any concrete clue of why this would occur. I should be missing something here, anyone has ideas?
All help appreciated.
thanx.
-
Nov 24th, 2004, 01:41 PM
#2
Fanatic Member
Are you using data readers? If so, you can set the CommandTimeout of a data reader. Here's an example.
VB Code:
Dim cn As New SqlClient.SqlConnection()
cn.ConnectionString = "Integrated Security=True;" & _
"Data Source=Server7;Initial Catalog=fuel info;" & _
"user id=sa;=;"
cn.Open()
Dim commSQL As New SqlClient.SqlCommand
commSQL.Connection = cn
commSQL.CommandTimeout = 500
Dim datRead As SqlClient.SqlDataReader
If you are using a data adapter, I do not know if the timeout can be set on that or not.
Also, you can change the timeout on your SQL server.
If you right click the server in Enterprise Manager, then left click properties. Ckick the Connections tab. Here is where you can change the Query Time out to 0 which is unlimted.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|