急!!!!!求解分页显示问题!请问rs.open问题!

bluebaby718 2004-01-08 10:21:24
若哪位大哥帮我解答了,给您加N多的分!谢谢了!!谢谢!!

这里一共有二段程序:
第一段:
<%'开始分页
Const MaxPerPage=8
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 100 sclassid from sclass ",conn,1,1

if rs.eof And rs.bof then
Response.Write "<p align='center' class='contents'> 对不起,目前没有更新商品!</p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"sclass.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"sclass.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"newshop.asp"
end if
end if
end if

sub showContent
dim i
i=0

%>
<%do while not rs.eof%>
第二段:不用了,这个没有问题的。

我想问的是第一段里的
rs.open "select top 100 sclassid from sclass ",conn,1,1

这里是怎么加的?
我的这个页叫sclass.asp
用在数据库里的是一个叫sclass的表,里面有如下字段:
sclassid,bclassid,sclassname,sclassjs,sclassimg,sclassimg2,sclassimg3,sclassimg4,sclassimg5,sclassimg6

sclassid是小类商品的号,bclassid是大类商品的号,sclassname是名称,sclassjs是介绍,其它是图片

请问怎么加才能分页显示我的商品啊?

谢谢大家了!!!!
...全文
39 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xzq686 2004-01-08
  • 打赏
  • 举报
回复
找些分页的源程序:和分页相关资料:自己看看:
http://search.csdn.net/expert/topic/3/301/2002/5/20/737447.htm
http://search.csdn.net/expert/topic/3/301/2002/9/6/1003331.htm
tangss 2004-01-08
  • 打赏
  • 举报
回复
试试这段:
<%
const MaxPerPage=30
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim sql
dim rs
dim rstype
dim typesql


if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
sql="select * from article order by dateandtime desc"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 新 闻</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"news.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"news.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"news.asp"
end if
end if
rs.close
end if

set rs=nothing
conn.close
set conn=nothing


sub showContent
dim i
i=0

%>
<table border="0" cellpadding="0" cellspacing="1" style="border-collapse: collapse" width="98%" id="AutoNumber1" align="center" bgcolor="#00CCFF" >
<tr bgcolor="#0066CC">
<td width="5%" align="center" height="22" bgcolor="#FF6633"> <font color="#FFFFFF">
Newsid</font></td>
<td width="26%" align="center" height="22"> <font color="#FFFFFF">题目</font></td>
<td width="14%" align="center" height="22"><font color="#FFFFFF">新闻分类</font></td>
<td width="12%" align="center" height="22"><font color="#FFFFFF">发布时间</font></td>
<td width="7%" align="center" height="22"><font color="#FFFFFF">hits</font></td>

<td width="12%" align="center" height="22"><font color="#FFFFFF">修改</font></td>
<td width="13%" align="center" height="22"><font color="#FFFFFF">删除</font></td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="eeeeee">
<td width="5%" align="center" height="18"><%=rs("newsid")%></td>
<td width="26%" align="center" height="18"><%=rs("title")%></td>
<td width="14%" align="center" height="18"><%=rs("type")%></td>
<td width="12%" align="center" height="18"><%=rs("newsdate")%> </td>
<td width="7%" align="center" height="18"><%=rs("hits")%></td>

<td width="12%" align="center" height="18"><a href="editnews.asp?newsid=<%=rs("newsid")%>&page=<%=CurrentPage%>" >修改</a></td>
<td width="13%" align="center" height="18"><a href="delenews.asp?newsid=<%=rs("newsid")%>&page=<%=CurrentPage%>">删除</a></td>
</tr>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
<center>
<%
end sub

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&">"

response.write "<p align='center'> "
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一页</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="¤tPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "<font color='#000080'>下一页 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 页次:</font><strong><font color=red>"¤tPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>条新闻 <b>"&maxperpage&"</b>条新闻/页</font> "
response.write " <font color='#000080'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
response.write "<input type='hidden' value='提交' name='submit1'><input type='image' src='../images/go.gif' value='提交' name='submit1' ></span></p></form>"
end function
%>
主动配电网故障恢复的重构与孤岛划分统一模型研究【升级版本】(Matlab代码实现)内容概要:本文提出了一种针对主动配电网故障恢复的重构与孤岛划分统一模型,并基于Matlab实现了相应的仿真代码。该模型在发生故障后,综合考虑网络拓扑重构与孤岛划分策略,旨在最大限度恢复重要负荷供电、提升供电可靠性与系统韧性。通过优化算法实现开关操作序列与分布式电源协调控制,确保孤岛内功率平衡与电压稳定,同时满足辐射状运行约束。研究体现了配电网智能化管理中对故障快速响应与资源优化配置的核心需求,适用于含高比例分布式能源的现代配电网场景。; 适合人群:电力系统及相关专业的研究生、科研人员以及从事配电网自动化、微电网控制、智能电网规划的工程技术人员。; 使用场景及目标:①研究配电网在故障情况下的快速恢复策略;②掌握网络重构与孤岛划分的协同优化方法;③学习基于Matlab的电力系统优化建模与求解技术;④为提升配电网韧性提供理论支持和技术参考。; 阅读建议:此资源以Matlab代码实现为核心,建议读者结合电力系统分析基础知识,仔细研读模型构建逻辑与算法实现细节,通过调试和修改代码加深对故障恢复机制的理解,并可进一步拓展至多目标优化、不确定性处理等方向。

28,407

社区成员

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

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