如何解決TimeOut過期問題?

[英]How to solve TimeOut Expired Problem?


Using SQL Server 2005 and VB6

使用SQL Server 2005和VB6

When I executing for yearly data or more than 3 months' data, it is showing "Timeout Expired" error. It is not executing completely.

當我執行年度數據或超過3個月的數據時,它顯示“Timeout Expired”錯誤。它沒有完全執行。

My Connection String

我的連接字符串

ConnectionString = "Provider=SQLOLEDB.1;" & _
    "Persist Security Info=False; " & _
    "User ID=" & Settings.SQL_Username & _
    "; Password = " & Settings.SQL_Password & "; " & _
    "Initial Catalog=" & Settings.SQL_DatabaseName & ";" & _
    "Data Source=" & Settings.SQL_ServerAddress

How do I solve this problem?

我該如何解決這個問題?

Plz...

PLZ ...

4 个解决方案

#1


17  

There's no "black voodoo magic" out there - either you can make your query go faster (return less data, improve the database design, find and apply indices that make your queries execute faster), or then increase the timeout you allow the query to run before a timeout is thrown.

那里沒有“黑巫毒魔法” - 你可以讓你的查詢更快(返回更少的數據,改進數據庫設計,查找和應用使你的查詢執行得更快的索引),或者然后增加你允許查詢的超時在拋出超時之前運行。

Those are your two options - take your pick.

這是你的兩個選擇 - 接受你的選擇。

UPDATE: a little googling reveals:

更新:一點點谷歌搜索顯示:

Dim cmd
Set cmd = Server.CreateObject("ADODB.Command")
cmd.CommandTimeout = 120   ' number of seconds

Marc

渣子

#2


2  

You have to set .CommandTimeout on the command. It doesn't work if you set it in the connection string.

您必須在命令上設置.CommandTimeout。如果在連接字符串中設置它,它將不起作用。

#3


1  

I would guess you're either trying to pull back a lot of data and it's taking SQL Server more than the default ADO timeout (either 30 or 40 seconds?) to pull that data back.

我猜你要么試圖撤回大量數據,要么SQL Server超過默認的ADO超時(30或40秒?)來拉回數據。

Or it's not really a lot of data, but you've not got a decent index on the table - so I'd check the indexes against your query (execution plan is your friend here).

或者它並不是真的很多數據,但你沒有在表上得到一個合適的索引 - 所以我會根據你的查詢檢查索引(執行計划是你的朋友)。

Or it's a mix of both.

或者它是兩者的混合。

How long does the query take if you run it direct in SQL Management Studio?

如果在SQL Management Studio中直接運行查詢,需要多長時間?

#4


0  

Obviously you are trying to bring up a lot of data, and your database is taking a lot of time doing this. Post your connection string so I can tell you what parameter to change so you can increase the connection time out.

顯然,您正在嘗試提供大量數據,而您的數據庫需要花費大量時間來完成此操作。發布您的連接字符串,以便我可以告訴您要更改的參數,以便您可以增加連接超時。

Or you can try to optimize your app, it should take that long to bring up data.

或者您可以嘗試優化您的應用程序,這需要花費很長時間才能顯示數據。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2009/10/13/1b7e6d7d47421195ddfa620c795718e1.html



 
  © 2014-2022 ITdaan.com 联系我们: