Increase Connection Timeout


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I have a query that is taking about 90 seconds.  The window times out before any data is displayed.  How do I increase the connection timeout for this query?

Thanks,
Bill

Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Wow, I remember when a T1 was a fast connection! BigGrin



You might try just writing your own FillByPrimaryKey, put it your base BO, so all your BOs use it and none of the client code needs changing. You could then reference a property that you can set to increase the timeout. The FillByPrimaryKey code is easy, especially if you only need to overload one of them. Then you could set the timeout on the SqlCommand object:



Public Overloads Sub FillByPrimaryKey(key As Integer)

  Dim sql As String

  sql = String.Format("Select * From {0} Where {1} = @key", Me.TableName, Me.PrimaryKeyField)

  Using cmd As New SqlCommand()

    cmd.CommandText = sql

    cmd.Parameters.AddWithValue("@key",key).SqlDbType = SqlDbType.int

    cmd.CommandTimeOut = 60 ' Time out in seconds...pull from a global property or something

    Me.FillDataTable(cmd)

  End Using

End Sub




There may be a way to set the timeout for a BusinessLayer also, but this might work (haven't tried it myself).
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 17 Years Ago
Bill Cunnien - 17 Years Ago
Bill Cunnien - 17 Years Ago
Edhy Rijo - 17 Years Ago
Paul Chase - 17 Years Ago
                         Bill, I thought that I had found where to set it on a per query...
Paul Chase - 17 Years Ago
                             Yeah, Paulnailed it on the last post. The most common timeout that is...
Trent L. Taylor - 17 Years Ago
                         Thanks Paul and Edhy!! I am still using SQL Server 2000...I will see...
Bill Cunnien - 17 Years Ago
                             [quote]If the command timeout can be set, how do I do that from the...
Trent L. Taylor - 17 Years Ago
                                 Thanks. Took me a minute to make the right connection from the command...
Bill Cunnien - 17 Years Ago
Kenneth Langley - 17 Years Ago
Greg McGuffey - 17 Years Ago
Kenneth Langley - 17 Years Ago
Greg McGuffey - 17 Years Ago
Kenneth Langley - 17 Years Ago
Peter Jones - 17 Years Ago
Peter Jones - 17 Years Ago
Larry Caylor - 17 Years Ago
Trent L. Taylor - 16 Years Ago
Edhy Rijo - 16 Years Ago
                     Good point. Yes, they should.
Trent L. Taylor - 16 Years Ago
Kenneth Langley - 16 Years Ago
Trent L. Taylor - 16 Years Ago
Kenneth Langley - 16 Years Ago
Trent L. Taylor - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search