TimeOut中的SQL已过期

时间:2011-03-17 07:45:51

标签: sql sql-server database web-config timeout

SQL的工作时间为47秒。

SELECT  B.HESAP_NO, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2 AS 'TEKLIF',B.MUS_K_ISIM,
dbo.fngcodeme(B.HESAP_NO, B.DOVIZ_KOD, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2,'20110201', '20110228') AS 'YATAN',
(CASE WHEN B.DOVIZ_KOD = 21 THEN 'EUR' WHEN B.DOVIZ_KOD = 2 THEN 'USD' WHEN B.DOVIZ_KOD = 1 THEN 'TL' END) AS 'KUR',
D.AVUKAT, 
(CASE WHEN D.HESAP IN (SELECT T_HESAP_NO FROM TAKIP) THEN 
(SELECT CONVERT(VARCHAR(10),ICRA_TAR,103) FROM TAKIP WHERE T_HESAP_NO = D.HESAP)
ELSE ' ' END) AS 'ICRA TARİHİ', 
(CASE WHEN D.HESAP IN (SELECT T_HESAP_NO FROM TAKIP) THEN 
(SELECT CONVERT(VARCHAR(10),HACIZ_TAR,103) FROM TAKIP WHERE T_HESAP_NO = D.HESAP)
ELSE '' END) AS 'HACİZ TARİHİ'
FROM YAZ..MARDATA.S_TEKLIF B, AVUKAT D
WHERE B.HESAP_NO = D.HESAP
AND B.KAPANIS_TAR IS NULL
AND ISNULL(dbo.fngcodeme(B.HESAP_NO, B.DOVIZ_KOD, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2,'20110201', '20110228'),0) > 0
GROUP BY B.HESAP_NO, B.TEKLIF_NO1 + '/' + B.TEKLIF_NO2,B.DOVIZ_KOD ,B.MUS_K_ISIM, D.AVUKAT, D.HESAP

我的TimeOut是Connect Timeout=20000

但我仍然收到此错误。

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

Line 160:      myConnection.Open();
Line 161:
Line 162:      SqlDataReader dr = myCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);
Line 163:
Line 164:      // show the data

我哪里可以做错?

2 个答案:

答案 0 :(得分:4)

您必须在myCommand对象中增加超时:

myCommand.CommandTimeout = 60000; // 1 minute, put 0 for infinite

答案 1 :(得分:1)

可能不是连接超时而是asp.net超时