主题:asp 分类 分页 显示
表格结构:
[img]http://www.china-dro.com/090122/table_structure.jpg[/img]
表格结构显示:
[img]http://www.china-dro.com/090122/table_show.jpg[/img]
<%
'将parent_id=0中的任何一项,将其子分类(包括子分类中的子分类)中的所有分类的cls_name字段找出来(形成记录集),然后以每5条记录进行分页输出,请问该如何做?
pid=0
call sub calss(pid)
sub class(pid)
'##########不知该如何做##########
set rs=server.createobject("adodb.recordset")
sql="select * from CommonSite_pcls where parent_id="&pid
rs.open sql,conn,1,1
'##########不知该如何做##########
MaxPerPage=5
totalPut=rs.recordcount '记录数
if (totalPut mod MaxPerPage)=0 then
tempPcount= totalPut \ MaxPerPage
else
tempPcount= totalPut \ MaxPerPage + 1
end if
'循环输出每页页面
for currentpage=1 to tempPcount
if (totalPut mod MaxPerPage)=0 then
Pcount= totalPut \ MaxPerPage
else
Pcount= totalPut \ MaxPerPage + 1
end if
rs.movefirst
if int(currentpage) > Pcount then currentpage = Pcount
if int(currentpage)<1 then currentpage=1
rs.Move (currentpage-1) * MaxPerPage
'显示内容
page_content=""
'根据MaxPerPage,输出每页显示MaxPerPage条记录的内容
i=0
do while not rs.eof and i<MaxPerPage
'每页需显示的记录内容归结到统一变量中
page_content=page_content&"<table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td>分类:"&rs("cls_name")&"</td></tr><tr><td height='18'></td></tr></table>"
i=i+1
rs.movenext
loop
response.write "第"¤tpage&"页<br>"
response.write page_content
next
rs.close
set rs=nothing
end sub
%>
[img]http://www.china-dro.com/090122/table_structure.jpg[/img]
表格结构显示:
[img]http://www.china-dro.com/090122/table_show.jpg[/img]
<%
'将parent_id=0中的任何一项,将其子分类(包括子分类中的子分类)中的所有分类的cls_name字段找出来(形成记录集),然后以每5条记录进行分页输出,请问该如何做?
pid=0
call sub calss(pid)
sub class(pid)
'##########不知该如何做##########
set rs=server.createobject("adodb.recordset")
sql="select * from CommonSite_pcls where parent_id="&pid
rs.open sql,conn,1,1
'##########不知该如何做##########
MaxPerPage=5
totalPut=rs.recordcount '记录数
if (totalPut mod MaxPerPage)=0 then
tempPcount= totalPut \ MaxPerPage
else
tempPcount= totalPut \ MaxPerPage + 1
end if
'循环输出每页页面
for currentpage=1 to tempPcount
if (totalPut mod MaxPerPage)=0 then
Pcount= totalPut \ MaxPerPage
else
Pcount= totalPut \ MaxPerPage + 1
end if
rs.movefirst
if int(currentpage) > Pcount then currentpage = Pcount
if int(currentpage)<1 then currentpage=1
rs.Move (currentpage-1) * MaxPerPage
'显示内容
page_content=""
'根据MaxPerPage,输出每页显示MaxPerPage条记录的内容
i=0
do while not rs.eof and i<MaxPerPage
'每页需显示的记录内容归结到统一变量中
page_content=page_content&"<table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td>分类:"&rs("cls_name")&"</td></tr><tr><td height='18'></td></tr></table>"
i=i+1
rs.movenext
loop
response.write "第"¤tpage&"页<br>"
response.write page_content
next
rs.close
set rs=nothing
end sub
%>