| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 457 人关注过本帖
标题:代码执行效率慢怎么办
取消只看楼主 加入收藏
jz1024
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-8-13
收藏
 问题点数:0 回复次数:0 
代码执行效率慢怎么办

<%Server.ScriptTimeout = 1000
on error resume next
connstr="DBQ="+server.mappath("savedata.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
set rs=server.CreateObject("adodb.recordset")
set rscity=server.CreateObject("adodb.recordset")
sql="select * from cust "
rs.open sql,conn,1,1
if rs.eof then
response.write "aa"
else
response.write "bb"
end if
%>
<%
currentPage="chengshi.asp"
const MaxPerPage=3000
dim rs,totalPut,CurrentPage,TotalPages,j,page_name,n,k,i
i=0
page_name="chengshi.asp?pro_id="&request.QueryString("pro_id")
set rs=server.createobject("adodb.recordset")
sql="select * from cust"
rs.open sql,conn,1,3
if rs.eof then
response.write "暂无数据!"
else
rs.MoveFirst
rs.pagesize=MaxPerPage
If trim(Request("Page"))<>"" then
CurrentPage= CLng(request("Page"))
If CurrentPage> rs.PageCount then
CurrentPage = rs.PageCount
End If
Else
CurrentPage= 1
End If
totalPut=rs.recordcount
if CurrentPage<>1 then
if (currentPage-1)*MaxPerPage<totalPut then
rs.move(currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
end if
end if
end if
if (totalPut mod MaxPerPage)=0 then
n=totalPut\MaxPerPage
else
n=totalPut\MaxPerPage+1
end if
do while not rs.eof and i<maxperpage
%>


<div align="center">
<table width="44%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td height="24" align="center">&#21495;&#30721;</td>
<td height="24" align="center">&#22478;&#24066;</td>
</tr>
<%do while not rs.eof
%>
<tr>
<td align="center"><%=rs("Mobile")%></td>

<td width="181" align="center"><%
sqlcity="select * from city where phone='"&left(rs("Mobile"),7)&"'"
rscity.open sqlcity,conn,1,1
if rscity.eof then
response.write "-"
else
response.write rscity("city")
end if
rscity.close

%></td>
</tr>
<%
rs.movenext
loop
%>
</table>

</div>

<!--下面是分页超链接部分-->
<%
i=i+1
rs.movenext
loop
%><%
k=currentPage
if k<>1 then
response.write "[<b>"+"<a href='"&page_name&"&page=1'>首页</a></b>] "
response.write "[<b>"+"<a href='"&page_name&"&page="+cstr(k-1)+"'>上一页</a></b>] "
else
Response.Write "[首页] [上一页]"
end if
if k<>n then
response.write "[<b>"+"<a href='"&page_name&"&page="+cstr(k+1)+"'>下一页</a></b>] "
response.write "[<b>"+"<a href='"&page_name&"&page="+cstr(n)+"'>尾页</a></b>] "
else
Response.Write "[下一页] [尾页]"
end if
rs.close()
%>
这段代码那位大哥可以帮我看看为什么执行效率慢啊!帮我修改一下啊!

搜索更多相关主题的帖子: Microsoft 效率 server set 
2006-04-18 08:55
快速回复:代码执行效率慢怎么办
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022406 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved