0

このクエリを実行しようとしています:

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.

このエラーが何度も発生する

4

2 に答える 2

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 ステートメントには、2 つのビュー間に明示的な 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'  

行数が天文学的な数である場合は、結合の問題があります。

于 2012-10-02T18:04:26.467 に答える
1

あなたはあなたのあなたを増やすことができConnect Timeoutますstring 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

于 2012-10-02T17:21:31.847 に答える