SQL 超时已过期

发布于 2024-10-22 06:43:39 字数 1453 浏览 3 评论 0原文

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

我的超时是 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

我哪里可以做错?

This SQL works in 47 second.

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

And my TimeOut is Connect Timeout=20000

But i still getting this error.

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

Where can i doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舟遥客 2024-10-29 06:43:39

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

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

You have to increase the timeout in the myCommand object:

myCommand.CommandTimeout = 60000; // 1 minute, put 0 for infinite
水中月 2024-10-29 06:43:39

也许不是连接超时而是asp.net超时

Maybe it's not connection timeout but asp.net timeout

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文