2012-10-02 118 views
-1

我試圖執行這個查詢:超時已過期。之前完成上述操作超時時間已過或服務器沒有響應

SELECT * from vwLstDtaLines d1,vwLStDtafiles d2 where d1.DtaLinePaymentDate='1/1/2000'or d1.DtaLinePaymentDate='1/1/2012' or d1.DtaLineUserCre='abc' or d1.DtaLineUserMatch='abc' or d2.DtaFileName='Sent' 



Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. 

再次得到這個錯誤,並再次

+0

你確定你想成爲做一個交叉聯接? – pete

+0

我想從兩個視圖中獲取和比較數據。必須這樣做:/ – vini

+0

2個不同的視圖是否有相似的列。可能你能夠對這兩個(每個都有自己的'WHERE'子句)做一個'UNION',而不是加入? 你在做什麼,從SQL的角度來看,似乎只是根本性的錯誤 - 這是造成你的超時。 – MattW

回答

2

那麼,就看你的SQL,它看起來像你對我要創建一個更大的結果集,比你打算。

SELECT * 
from vwLstDtaLines d1,vwLStDtafiles d2 
where d1.DtaLinePaymentDate='1/1/2000' or 
d1.DtaLinePaymentDate='1/1/2012' or 
d1.DtaLineUserCre='abc' or 
d1.DtaLineUserMatch='abc' or 
d2.DtaFileName='Sent' 

此SQL語句在兩個視圖之間沒有顯式JOIN。因此,你得到的結果集可能是d1r * d2r的大小,其中d1r是d1中的行數,d2r是d2中的行數。

我開始尋找在那裏。在SQL服務器中運行以下查詢以查明:

SELECT COUNT(*) 
from vwLstDtaLines d1,vwLStDtafiles d2 
where d1.DtaLinePaymentDate='1/1/2000' or 
d1.DtaLinePaymentDate='1/1/2012' or 
d1.DtaLineUserCre='abc' or 
d1.DtaLineUserMatch='abc' or 
d2.DtaFileName='Sent' 

如果行數是天文數字,則表示有聯接問題。

0

您可以增加Connect Timeoutstring connection

諾塔:默認值是15秒

調整

樣品

<add name="ConnectionString" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=;Connect Timeout=200" providerName="System.Data.SqlClient"/> 
</connectionStrings> 

鏈接:http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

+0

它仍然給出了同樣的錯誤:/ – vini

+0

您可以定義會話asp.net的超時,因爲它可能是你的asp.net會話超時,請嘗試使用 <的sessionState超時=「...」 /> .... –

+0

我認爲有一些問題,我的查詢嘗試了這種方法以及不工作相同的錯誤 – vini

相關問題