ASP+SQLServer写的WEB程序,现SQL表里有2W多条数据,目前打开程序速度很慢,竟然有时会没有任何数据显示,请问高人什么原因

flyso 2006-08-09 05:40:54
ASP+SQLServer写的程序,现在SQL表里有2W多条数据,现在打开速度很慢,竟然有时会没有任何数据显示,需要刷新一两次才有数据显示,请问高人什么原因,以前都没有这种原因的,难道是原因流量大了,连接速度慢加上数据太多就会出现这样的情况??
...全文
314 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
flyso 2006-08-11
  • 打赏
  • 举报
回复
没有高手知道?
现在打开速度快了,但就是不显示数据,在SQL查询分析器里执行那条SQL语句没有问题
flyso 2006-08-11
  • 打赏
  • 举报
回复
代码如下:
用Response.write输出语句在SQL查询器里执行器是正常的,在网页里咋就是显示不出来列


<%
If action="search" Then
'*********************************************************************************************************************************
'搜索
'*********************************************************************************************************************************
Select Case(hav)
Case "back"
CursorBegin=CursorEnd
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 and ("&stypes&" like '%"&key&"%' "&www&") and addtime>'"&CursorBegin&_
"' And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 and ("&stypes&" like '%"&key&"%' "&www&") and addtime>'"&CursorBegin&"') Order by addtime desc"
Case "next"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 and ("&stypes&" like '%"&key&"%' "&www&") and addtime<'"&CursorBegin&_
"' Order by addtime desc"
Case "last"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table where tg=1 and ("&stypes&" like '%"&key&"%' "&www&") And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 and ("&stypes&" like '%"&key&"%' "&www&") Order by addtime) Order by addtime desc"
End Select
'sql1="第一个SQL语句"&SQLstr
elseif action="S" Then
'*********************************************************************************************************************************
'模糊搜索
'*********************************************************************************************************************************
Select Case(hav)
Case "back"
CursorBegin=CursorEnd
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 and (area like '%"&key&"%' or pdname like '%"&key&"%' or cname like '%"&key&"%' or pdgx like '%"&key&"%') and addtime>'"&CursorBegin&_
"' And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 and (area like '%"&key&"%' or pdname like '%"&key&"%' or cname like '%"&key&"%' or pdgx like '%"&key&"%') and addtime>'"&CursorBegin&"') Order by addtime desc"
Case "next"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 and (area like '%"&key&"%' or pdname like '%"&key&"%' or cname like '%"&key&"%' or pdgx like '%"&key&"%') and addtime<'"&CursorBegin&_
"' Order by addtime desc"
Case "last"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table where tg=1 and (area like '%"&key&"%' or pdname like '%"&key&"%' or cname like '%"&key&"%' or pdgx like '%"&key&"%') And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 and (area like '%"&key&"%' or pdname like '%"&key&"%' or cname like '%"&key&"%' or pdgx like '%"&key&"%') Order by addtime) Order by addtime desc"
End Select
'sql2="第二个SQL语句"&SQLstr
Else
'*********************************************************************************************************************************
'列表
'*********************************************************************************************************************************
Select Case(hav)
Case "back"
CursorBegin=CursorEnd
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 "&abc&" and kind like '%"&kind&"%' and addtime>'"&CursorBegin&_
"' And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 "&abc&" and kind like '%"&kind&"%' and addtime>'"&CursorBegin&"') Order by addtime desc"
Case "next"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table Where tg=1 "&abc&" and kind like '%"&kind&"%' and addtime<'"&CursorBegin&_
"' Order by addtime desc"
Case "last"
SQLstr="Select Top "&DefRecordNum&" addtime,id,pdname,cname,seltypes,kind,lsprice,zsprice,pic,uid,province,city From xxx_table where tg=1 "&abc&" and kind like '%"&kind&"%' And addtime In (Select Top "&DefRecordNum&" addtime From xxx_table Where tg=1 "&abc&" and kind like '%"&kind&"%' Order by addtime) Order by addtime desc"
End Select
'sql3="第三个SQL语句"&SQLstr
End If
%>
being21 2006-08-11
  • 打赏
  • 举报
回复
把你的查询代码帖出来 看看?
呵呵??

ice241018 2006-08-11
  • 打赏
  • 举报
回复
顶下
^_^
addwing 2006-08-11
  • 打赏
  • 举报
回复
mark
leohuang 2006-08-11
  • 打赏
  • 举报
回复
超时了
----------------------------------

影响服务器产生超时的设置大致有:
1. Server.ScriptTimeout
2. Connection对象的CommandTimeOut属性
3. Command对象的CommandTimeOut属性
4. IE浏览器的设置

Server.ScriptTimeout,默认值是90秒.
要增大它,在你的asp文件中加一句,将页面超时设为999秒. 如下:
Server.ScriptTimeout=999

只设Server.ScriptTimeout有时还是不行的!
Connection对象和Command对象都有个CommandTimeOut属性,
默认是30秒,如果你有一个耗时的查询或数据处理,
很容易就超时了.要增大它,也很容易,创建对象后,
设置它的属性,如下:
conn.CommandTimeOut = 999
设为999秒,其中con是一Connection对象.
如设为零,将无限等待,没有这一timeout限制.

Command对象不会继承Connection的这一属性,
所以对可能超时的Command也要单独设置CommandTimeout属性.

最后IE也有个超时设置,5分钟从服务器得不到数据,也超时.
这种情况可能很少碰到,

最好再优化一下代码
bykai 2006-08-11
  • 打赏
  • 举报
回复
同上,2万不大吧
heyjude1983 2006-08-11
  • 打赏
  • 举报
回复
使用存储过程,上W条记录使用存储过程,理论速度可以提高21%,而且速度特别快!!
完毕!
  • 打赏
  • 举报
回复
索引??
loye 2006-08-09
  • 打赏
  • 举报
回复
2W而已,这么点数据不会有问题,代码优化下吧
明珠佩佩 2006-08-09
  • 打赏
  • 举报
回复
修改IIS超时时间,将其延长

另外,如果数据量比较大的话

最好采用存储过程

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧