超时已过期。 complet之前经过的超时时间...错误Occure

编程入门 行业动态 更新时间:2024-10-26 01:17:43
本文介绍了超时已过期。 complet之前经过的超时时间...错误Occure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在Sql数据库中有一个表,在表中有超过40,000条记录..., 现在在我的网站的一页上, i希望根据动态查询显示该数据(根据条件添加多个查询),然后将此查询的所有结果返回给DataTable和然后把它放入GRIDVIew, 现在我的问题是,当我想一次显示所有结果然后它给出错误这样的..

I have a table in Sql Database And in table there in more then 40,000 record..., Now on one page of my site,, i want to show that data according to Dynamic query(add Multiple Query According to condition),and then return all result of this query to DataTable and Then Put It into GRIDVIew, Now My problem is, when i want to show all result at a time then it gives error Like this..

Timeout expired. The timeout period elapsed prior to complete

查询无效返回 ,,, 当我根据某些条件获取数据然后它返回完美数据(当数据表的结果低时表示工作正常......), 这是我的代码:

or Query Return Nothing,,, And when i take data according to some condition then It Return perfect data(Means When Result of data table is low then it work fine...), This is My Code:

StringBuilder strSql2 = new StringBuilder(); strSql2.Append("SELECT t.id, t.year,t.courtname,t.partyname,t.itano,t.favour,t.sectionno, STUFF((SELECT ' ' + s.sitentionno ,' ' + s.subjudgements,' ' + s.page , ' ' FROM tblJudgements s WHERE s.partyname = t.partyname FOR XML PATH('')),1,0,'') AS Citation FROM tblJudgements AS t where t.categoryname='Direct Taxes' "); if (txtWordAd.Text != "") { string keywords = txtWordAd.Text; if (!string.IsNullOrEmpty(keywords)) { string[] words = keywords.Split(' '); for (int i = 0; i < words.Length; i++) { if (i == 0) { strSql2.Append(" and ( t.judgement like '%[^a-z]" + words[i].ToString().Trim() + "[^a-z]%' ) "); } else { strSql2.Append(" and judgement like '%[^a-z]" + words[i].ToString().Trim() + "[^a-z]%'"); } } } } if (txtDateFromAd.Text != "" && txtDateToAd.Text != "") { strSql2.Append(" and (dateofjudgement between '" + txtDateFromAd.Text + "' and '" + txtDateToAd.Text + "' ) "); } SqlDataAdapter adp4 = new SqlDataAdapter(strSql2.ToString(), strConn); adp4.Fill(dt); GridJudgementAdvanced1.DataSource = dt; GridJudgementAdvanced1.DataBind(); }

i也可以尝试:adp4.SelectCommand.CommandTimeout = 120 ; 但它不起作用, i一次应用于GridView 20记录,但是问题是查询返回所有40000记录到数据表而这耗费了这么多时间,完成一个查询(过程...), 所以在那种情况下我能做什么?做??????? Plz帮助.. 我也在这里找到同样的问题,但没有解决方案.. [ ^ ] 如何解决经典ASP中的超时错误 [ ^ ] 超时sql server问题 [ ^ ]

i also try :adp4.SelectCommand.CommandTimeout = 120; but it not work,, i apply pagging to GridView 20 record at a time, But Problem is Query Return All 40000 record to datatable And this Consume So much Time, to complete one Query(Process...), So in that Situation What can i Do ??????? Plz help.. I Also Find Same Problem Here,But There is no solution.. [^] How to resolve Time out Error in Classic ASP[^] Timeout expired sql server problem[^]

推荐答案

如果您使用的是SQL Server 2012,则可以使用ORDER BY子句的OFFSET和FETCH参数。请参阅 ORDER BY子句(Transact-SQL) 检索前20行 If you are using SQL Server 2012, you could use the OFFSET and FETCH arguments of the ORDER BY clause. See ORDER BY Clause (Transact-SQL) Retrieves first 20 rows select * from people order by lastname,firstname offset 0 rows fetch next 20 rows only

检索接下来的20行

Retrieves next 20 rows

select * from people order by lastname,firstname offset 20 rows fetch next 20 rows only

那说,我觉得任何阙在一个在线业务应用程序中,返回与查询一样多的行应该应用其他选择条件,以大大减少检索的行数。您的用户可能不希望一次分页40,000行20。这是下一步的2,000次点击。让用户花时间让他们使用其他选择标准来选择他们真正需要看到的那几行时,会更加考虑。

That said, I think that any query in an online business application that returns as many rows as your query should have additional selection criteria applied to greatly reduce the number of rows retrieved. Your user probably does not want to page through 40,000 rows 20 at a time. That is 2,000 clicks on Next. It would be more considerate of your user's time to let them use additional selection criteria to select only those few rows that they really need to see.

增加超时不是最佳解决方案。 。 Mike在他的解决方案中指出了一种采用按需加载方法来获取记录的好方法。我的建议也是一样的。 添加一个链接供你参考,作为这种方法之一。 HTTP://www.aspsnippets / Articles / on-demand-data-in-GridView-on-scroll-using-ASPNet-and-jQuery-AJAX.aspx [ ^ ] 希望这有帮助...... Increasing the timeout is not a optimal solution for this . Mike in his solution have pointed out a good way to have a Load on Demand approach for fetching the records. My suggestion would be also the same. Adding a link for your reference as one of the way to this approach. www.aspsnippets/Articles/Load-on-demand-data-in-GridView-on-scroll-using-ASPNet-and-jQuery-AJAX.aspx[^] Hope this helps...

更多推荐

超时已过期。 complet之前经过的超时时间...错误Occure

本文发布于:2023-11-27 02:55:28,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636274.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   时间   已过期   Occure   complet

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!