Results 1 to 2 of 2

Thread: ASP.Net over SQL Server - Connection Timeout

  1. #1

    Thread Starter
    Hyperactive Member vbud's Avatar
    Join Date
    Jan 2002
    Location
    Mru 20 17S, 57 33E Goal: Get out of the BOX Status: In The Shadows!!! Target Posts: 3,000,000,000
    Posts
    378

    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.
    >!v!<
    Free your mind, stop thinking
    http://inspirone.blogspot.com

    Please rate this post if it helped you

  2. #2
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612
    Are you using data readers? If so, you can set the CommandTimeout of a data reader. Here's an example.
    VB Code:
    1. Dim cn As New SqlClient.SqlConnection()
    2.  
    3. cn.ConnectionString = "Integrated Security=True;" & _
    4. "Data Source=Server7;Initial Catalog=fuel info;" & _
    5. "user id=sa;=;"
    6. cn.Open()
    7.  
    8. Dim commSQL As New SqlClient.SqlCommand
    9.  
    10.  commSQL.Connection = cn
    11.  commSQL.CommandTimeout = 500
    12.  
    13.  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.
    David Wilhelm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width