当我点搜索后 翻页时候就显示数据库里所有的数据 麻烦大家帮我看看代码错在哪里 谢谢
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="conn.asp" -->
<%
spxl=request("spxl")
set rs=server.createobject("adodb.recordset")
sqltext="select * from learning"
if request("Name")<>"" then
sqltext=sqltext &" where Name like '%"& request("Name") &"%' "
else
sqltext=sqltext &" where Name like '%"& "" &"%' "
end if
if request("Product_Class")<>"" then
sqltext=sqltext &" and Class_1 like '%"& request("Product_Class") &"%' "
end if
rs.open sqltext,conn,1,1
dim MaxPerPage
MaxPerPage=9
'取得页数,并判断用户输入的是否数字类型的数据,如不是将以第一页显示
dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next
If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<script>
function openbag(id) { window.open("eshop.asp?cpbm="+id,"","height=200,width=700,left=190,top=0,resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");}
</script>
<title>产品分类<%= request("Name")%><%= request("Name")%></title>
<href="style.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<center>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="600" height="92" >
<tr>
<td width="100%" height="70">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="148" >
<tr><td valign="top">
<div align="center">
<%
'假如没有商品时
If rs.eof and rs.bof then
response.write "<td><p align='center'><font color='#ff0000'>没有找到符合条件的商品资料</font></p></td>"
response.end
End if %>
<table border="0" cellspacing="1" width="100%" bordercolorlight="#006699" bordercolordark="#FFFFFF" height="57" bgcolor="#000000">
<tr>
<td width="16%" align="center" bgcolor="#006699">Id</td>
<td width="16%" align="center" bgcolor="#006699" height="14"><font color="#FFFFFF">商品编号</font></td>
<td width="34%" align="center" bgcolor="#006699" height="14"><font color="#FFFFFF">商品名称</font></td>
<td width="18%" align="center" bgcolor="#006699">pic</td>
<td width="18%" align="center" bgcolor="#006699" height="14"><font color="#FFFFFF">会员价</font></td>
<td width="15%" align="center" bgcolor="#006699" height="14"><font color="#FFFFFF">购买</font></td>
</tr>
<%row_count=1
'显示帖子的子程序
Sub list()%>
<%i=0
Do While Not rs.EOF%>
<tr>
<td width="16%" align="center" bgcolor="#EEEEEE"><%=rs("Id")%></td>
<td width="16%" align="center" height="39" bgcolor="#EEEEEE"><%=rs("articleid")%></td>
<td width="34%" align="center" height="39" bgcolor="#EEEEEE" ><%=rs("Name")%></td>
<td width="18%" align="center" bgcolor="#EEEEEE"><img border="0" src="<%=rs("picture")%>"> </td>
<td width="18%" align="center" height="39" bgcolor="#EEEEEE"><%=rs("Price")%></td>
<td width="15%" align="center" height="39" bgcolor="#EEEEEE"><a href='javascript:openbag(<%=rs("articleid")%>)'><img style="CURSOR: hand" src="images/mybuy.gif" align="absMiddle" border="0"></a></td>
</tr>
<%
i=i+1
if i >= MaxPerpage then exit do
rs.MoveNext
Loop
end Sub
%>
<% call list
If Rs.recordcount > MaxPerPage then
call showpages
end if%>
</table>
</div>
</td></tr>
</table>
</div>
</td>
</tr>
</table>
</div>
<%
'显示翻页的子程序
sub showpages()%>
<table bgColor="#f8e8a0" border="0" cellPadding="0" cellSpacing="0" width="400" >
<tr><td >
<form method="POST" action="spss.asp">
<INPUT type=hidden value=<%=spxl%> name=spxl>
<table bgColor="#006699" border="0" cellPadding="0" cellSpacing="0" width="583" height="30">
<tr>
<td bgcolor="#eeeeee" width="510">
<font color="#000000">
<p align="center">
<%
Response.write "<font color='#000000'>页面-> </font>"
If currentpage > 1 Then
response.write "<a href='spss.asp?&page="+cstr(1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>首页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='spss.asp?page="+Cstr(currentpage-1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>前页</font></a><font color='#000000'><b>-</b></font>"
Else
Response.write "<font color='#000000'>首页-</font>"
Response.write "<font color='#000000'>前页-</font>"
End if
If currentpage < Rs.PageCount Then
Response.write "<a href='spss.asp?page="+Cstr(currentPage+1)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>后页</font></a><font color='#000000'><b>-</b></font>"
Response.write "<a href='spss.asp?page="+Cstr(Rs.PageCount)+"&spxl="+Cstr(spxl)+"'><font color='#000000'>尾页</font></a> "
Else
Response.write "<font color='#000000'>后页-</font>"
Response.write "<font color='#000000'>尾页</font> "
End if
Response.write "<font color='#000000'>页次:</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font> "
Response.write "<font color=#ff0000>" & Cstr(MaxPerPage) & "</font>" & "<font color='#000000'>种商品/页 " & "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>种商品</font> "
response.write "</td><td align='right'>"
response.write "<font color='#000000' >到:</font><input type='text' name='page' size=2 maxlength=3 class=smallInput value="&Currentpage&"> "
response.write "<input class=buttonface type='submit' value='Go' name='cndok' style='background-color: #eeeeee'></span>"
%>
</font>
</td>
</tr>
</table>
</center>
</td></tr>
</table>
</form>
<%end sub%>
</body>
</html>