ASP产品分类显示条数问题
我的产品分类比较多,但在首页产品列表里,我只想显示六条产品分类代码如下:<%sql1="selecttop6*fromclassorderbyfoasc"Setrs1=S...
我的产品分类比较多,但在首页产品列表里,我只想显示六条产品分类代码如下:
<%
sql1=" select top 6 * from class order by fo asc "
Set rs1=Server.CreateObject("ADODB.RecordSet")
rs1.open sql1,conn,1,1
if rs1.eof then
response.write "系统中还没有产品分类信息!"
else
Do while not rs1.eof
%>
<table width="205" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24" height="25"> </td>
<td width="171"><span class="cs">·</span><a href="product.asp?classid=<%=rs1("id")%>"><%=left(rs1("classname"),30)%></a></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
rs1.MoveNext
i=i+1
Loop
end if
rs1.close
set rs1=nothing
%>
在线等急急急!!请高手帮帮忙!!!!! 展开
<%
sql1=" select top 6 * from class order by fo asc "
Set rs1=Server.CreateObject("ADODB.RecordSet")
rs1.open sql1,conn,1,1
if rs1.eof then
response.write "系统中还没有产品分类信息!"
else
Do while not rs1.eof
%>
<table width="205" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24" height="25"> </td>
<td width="171"><span class="cs">·</span><a href="product.asp?classid=<%=rs1("id")%>"><%=left(rs1("classname"),30)%></a></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
rs1.MoveNext
i=i+1
Loop
end if
rs1.close
set rs1=nothing
%>
在线等急急急!!请高手帮帮忙!!!!! 展开
2个回答
2008-06-28
展开全部
sql1=" select top 6 * from class order by fo desc"
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
dim sql,rs1
set rs1 = server.CreateObject("adodb.recordset")
sql = "select * from class order by fo asc"
rs1.open sql,conn,1,3
if not rs1.eof then
rs1.pagesize=6 '定义一页显示的记录数目
tatalrecord=rs1.recordcount '获取记录总数目
tatalpages=rs1.pagecount '获取分页的数目
rs1.movefirst
nowpage=request("page")
end if '用request获取当前页数,注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end if
rs.absolutepage=nowpage '将指针移动到当前显示页的第一条记录
j = 6
do While ((j <> 0) AND (NOT rs1.EOF))
%>
<table width="205" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24" height="25"> </td>
<td width="171"><span class="cs">·</span><a href="product.asp?classid=<%=rs1("id")%>"><%=left(rs1("classname"),30)%></a></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
j = j-1
rs1.MoveNext()
loop
%>
<form style="margin-bottom:0px" name="form1" method="post" action="要分页的文件名">
<%
response.write "共"&tatalrecord&"条信息 "
if nowpage<>1 then
response.write "<a href=要分页的文件名?page=1>首页</a> "
response.write "<a href=要分页的文件名?page="&(nowpage-1)&">上一页</a> "
end if
if nowpage<>rs1.pagecount then
response.write "<a href=要分页的文件名?page="&(nowpage+1)&">下一页</a> "
response.write "<a href=要分页的文件名?page="&rs1.pagecount&">尾页</a> "
end if
%>
第<%=nowpage%>页/共有<%=rs1.pagecount%>页<input name="page" size="2" value="<%=page%>"><input type="submit" method="submit" value="跳转">
</form>
dim sql,rs1
set rs1 = server.CreateObject("adodb.recordset")
sql = "select * from class order by fo asc"
rs1.open sql,conn,1,3
if not rs1.eof then
rs1.pagesize=6 '定义一页显示的记录数目
tatalrecord=rs1.recordcount '获取记录总数目
tatalpages=rs1.pagecount '获取分页的数目
rs1.movefirst
nowpage=request("page")
end if '用request获取当前页数,注意page是自己定义的变量并非函数
if nowpage&"x"="x" then '处理页码为空时的情况
nowpage=1
else
nowpage=cint(nowpage) '将页码转换成数字型
end if
rs.absolutepage=nowpage '将指针移动到当前显示页的第一条记录
j = 6
do While ((j <> 0) AND (NOT rs1.EOF))
%>
<table width="205" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="24" height="25"> </td>
<td width="171"><span class="cs">·</span><a href="product.asp?classid=<%=rs1("id")%>"><%=left(rs1("classname"),30)%></a></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
j = j-1
rs1.MoveNext()
loop
%>
<form style="margin-bottom:0px" name="form1" method="post" action="要分页的文件名">
<%
response.write "共"&tatalrecord&"条信息 "
if nowpage<>1 then
response.write "<a href=要分页的文件名?page=1>首页</a> "
response.write "<a href=要分页的文件名?page="&(nowpage-1)&">上一页</a> "
end if
if nowpage<>rs1.pagecount then
response.write "<a href=要分页的文件名?page="&(nowpage+1)&">下一页</a> "
response.write "<a href=要分页的文件名?page="&rs1.pagecount&">尾页</a> "
end if
%>
第<%=nowpage%>页/共有<%=rs1.pagecount%>页<input name="page" size="2" value="<%=page%>"><input type="submit" method="submit" value="跳转">
</form>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询