这样写是不是更好呢?
[admin_product.asp页面]
... ...
<%
sql="select * from news order by news_no desc"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,3
%>
<%If IsNumeric(Request("Page"))=false Or Request("Page")="" Then
Page=1
Else
Page=CInt(Request("Page"))
End if
Rs.PageSize=15
%>
<%if rs.bof and rs.eof then
response.write"暂时还没有发布产品!"
else%>
您已发布<%=rs.recordcount%>件产品.
<%myPageSize=Rs.PageSize
Rs.AbsolutePage=Page
Do While not Rs.Eof And myPageSize>0
%>
这里是循环的内容
<%
myPageSize=myPageSize-1
i=i+1
Rs.MoveNext
Loop
%><%end if%>
<br>
????产品总数:<%=Rs.RecordCount%>个;每页显示:<%=Rs.PageSize%>个;第<%=Page%>页/共<%=Rs.PageCount%>页.
<%
If Page > 1 Then
Response.Write "<a href='admin_product.asp?Page=1' title='首页'><font face=webdings>" & 9 & "</font></a>"
Response.Write "?<a href='admin_product.asp?Page="&Page-1&"' title='上一页'><font face=webdings>" & 7 & "</font></a>"
End If
For j = 1 To Rs.PageCount
Response.Write "?<a href='admin_product.asp?Page="&j&"'>" & j & "</a>"
Next
If Page < Rs.PageCount Then
Response.Write "?<a href='admin_product.asp?Page="&Page+1&"' title='下一页'><font face=webdings>" & "8" & "</a></font>"
End If
Response.Write "?<a href='admin_product.asp?Page="&Rs.PageCount&"' title='尾页'><font face=webdings>:</a>"
%>
<%
Rs.Close
Set Rs=nothing
%>
按分类查看:
<%
set rs=server.CreateObject("ADODB.recordset")
sql="select * from class"
rs.open sql,conn,3,3
%>
<select name="class" onchange="Javascript:window.location.href='admin_viewbyclass.asp?class='+this.value;" id="p1">
<option selected
value="全部">--全部分类--</option>
<%do while not rs.eof%>
<option value="<%=rs("class")%>">--<%=rs("class")%>--</option>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
</select>
... ...
[admin_viewbyclass.asp]页面
<%
Dim id
id=Request("class")
Set rs= Server.CreateObject("ADODB.Recordset")
if id="全部" then
sql="select * from news"
else
sql="select * from news where class='"&id&"'"
end if
rs.open sql,conn,3,3
%>
... ... 下面也是和admin_product.asp一样的,循环显示,分页等,不在详述!
[[italic] 本帖最后由 xmuer 于 2007-12-22 16:07 编辑 [/italic]]