| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 912 人关注过本帖
标题:关于LIKE查询后分页的问题
取消只看楼主 加入收藏
flyhere
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-8
收藏
 问题点数:0 回复次数:3 
关于LIKE查询后分页的问题

我通过关键字从一张表中过滤出符合条件的记录后显示在列表中,当超过15条记录就要分页显示

查询后(超过15条记录),第一页显示的是正常的

"

共有 32 条记录

3

现在是第 1

首页 上一页 下一页 尾页

"

但我,跳转到下一页时,就变成了

共有 491 条记录

33

现在是第 2

首页 上一页 下一页 尾页

也就是说,变成了没有过滤的全部记录,我把这个文件的脚本全部贴上了,有谁知道,告诉我一下呀,感激不尽!

<!--#include file="conn1.asp"-->
<!--#include file="config.asp"-->
<%
dim rs,sql,i,tj,class1,class2,cnmai,diqu
set rs=server.createobject("ADODB.recordset")
key=request("keyword")
if request("page")="" then
ThisPage=1
else
ThisPage=request("page")
end if
%>
<HTML><HEAD><TITLE><%=title%>-全部信息</TITLE>
<link href="inc_style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY topMargin=0>
<!--#include file="index_top.asp" -->
<!--#include file=bar.asp-->
<div align="center">
<table width="760" bgcolor="#FFFFFF" style="padding:0; ">
<tr><td width="200" valign="top" bgcolor="#F5F9E3">
 <td valign="top" width="560">
<table width="100%" id="table1" height="97">
<tr>
<td height="24" class=td2_muen bgcolor="#62AFFD" >
&nbsp;搜索关键字:<font color="#00FF00"><%=key%></font></td>
</tr>
<tr>
<td height="75" valign="top" width="597" colspan="2">
<div align="center">
<table border="1" width="100%" id="table1" cellspacing="1" bordercolor="#F2F2F2" style="border-collapse: collapse">
<tr>
<td style="width: 51; background-color:#F0E9C8" align="middle" height="25">方式</td>
<td style="width: 249px; background-color:#F0E9C8" align="middle" height="25">
标题/简介 <font color="#008080">(<img border="0" src="images/num/pic.gif" width="13" height="13">-图片
<img border="0" src="images/num/jsq.gif" width="12" height="12">-置顶
<img border="0" src="images/num/jian.gif" width="15" height="15">-推荐)</font></td>
<td style="width: 70px; background-color:#F0E9C8" align="middle" height="25">
地区</td>
<td style="width: 50px; background-color:#F0E9C8" align="middle" height="25">
价格</td>
<td style="width: 80px; background-color:#F0E9C8" align="middle" height="25">
击/回</td>
<td style="width: 65px; background-color:#F0E9C8" align="middle" height="25">日期</td>
</tr>
<%
dim ThisPage,Pagesize,Allrecord,Allpage,leixing
tj=0
sql = "select * from xinxi where biaoti like '%"&key&"%' order by id desc"

rs.open sql,conn,3,1,1
rs.Pagesize=15
Pagesize=rs.Pagesize
Allrecord=rs.Recordcount
Allpage=rs.Pagecount
if ThisPage<1 then
ThisPage=1
end if
On Error Resume Next
rs.move (ThisPage-1)*Pagesize
if rs.eof then
response.write "还没有添加信息!"
else
do while not rs.eof
response.write "<tr>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""60"" height=""22"">"
Select Case rs("leixing")
Case "1"
response.write "<font color=""#800000"">"&leixing1&"</font>"
Case "2"
response.write "<font color=""#FF00FF"">"&leixing2&"</font>"
Case "3"
response.write "<font color=""#008000"">"&leixing3&"</font>"
Case "4"
response.write "<font color=""#FF6600"">"&leixing4&"</font>"
Case "5"
response.write "<font color=""#ff0000"">"&leixing5&"</font>"
Case "6"
response.write "<font color=""#000080"">"&leixing6&"</font>"
Case "7"
response.write "<font color=""#0000FF"">"&leixing7&"</font>"
Case "8"
response.write "<font color=""#008080"">"&leixing8&"</font>"
Case Else
response.write "<font color=""#000000"">"&leixing9&"</font>"
End Select
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""left"" width=""342"" height=""22"">"
if rs("tupian")<>"0" then
response.write "<img src=""images/num/pic.gif"" alt=""有图片"">"
end if
response.write "<a target=""_blank"" title="""&rs("name")&"-发布于"&datevalue(rs("fbsj"))&""" href=xinximemo.asp?cnmai="&rs("id")&">"
response.write ""&rs("biaoti")&""
response.write "</a>"
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""80"" height=""22"">"&rs("diqu")&"</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""40"" height=""22"">"
if rs("jiage")=0 then
response.write "面 议"
else
response.write rs("jiage")
end if
response.write "</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""50"" height=""22"">"&rs("llcs")&"/"&rs("hfcs")&"</td>"
response.write "<td style=""BACKGROUND-COLOR: #F3F3F3"" align=""middle"" width=""80"" height=""22"">"&datevalue(rs("fbsj"))&"</td></tr>"
response.write "<tr><td width=""60""></td><td colspan=5 height=""22"">"&mid(rs("memo"),1,90)&"</td></tr>"
response.write "<tr><td background=""images/dotbar.gif"" height=""6"" colspan=6></td></tr>"
tj=tj+1
rs.movenext
if tj>=Pagesize then exit do
loop
end if
rs.close
set rs=nothing
%>
</table>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="552" bgcolor="#F2F2F2">
<tr>
<td height="25" width="151">
<p align="center">
共有&nbsp;<font color="#CC5200"><%=Allrecord%></font>&nbsp;条记录</td>
<td height="25" width="126">
<p align="center">共 <font color="#CC5200"><%=Allpage%></font> 页</td>
<td height="25" width="118">
<p align="center">现在是第
<font color="#CC5200"><%=ThisPage%></font> 页</td>
<td height="25" width="157">
<p align="center">
<%
if ThisPage<2 then
response.write "<font color=""#808080"">首页</font>&nbsp;"
response.write "<font color=""#808080"">上一页</font>&nbsp;"
else
response.write "<a href=?page=1&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">首页</a>&nbsp;"
response.write "<a href=?page="&ThisPage-1&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">上一页</a>&nbsp;"
end if
if Allpage-ThisPage<1 then
response.write "<font color=""#808080"">下一页</font>&nbsp;"
response.write "<font color=""#808080"">尾页</font>&nbsp;"
else
response.write "<a href=?page="&(ThisPage+1)&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">下一页</a>&nbsp;"
response.write "<a href=?page="&Allpage&"&class1="&class1&"&class2="&class2&"&cnmai="&cnmai&">尾页</a>&nbsp;"
end if
%></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</table>
</div><!--#include file="index_down.asp" -->
</BODY></HTML>
<%
closedb
%>

搜索更多相关主题的帖子: LIKE align 记录 center 
2005-12-08 22:55
flyhere
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-8
收藏
得分:0 
谢谢了我去试一试
2005-12-09 08:47
flyhere
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-8
收藏
得分:0 

还是不行呀,有谁知道呀,告诉我吧

2005-12-09 12:42
flyhere
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2005-12-8
收藏
得分:0 

5楼的你好,你说KEY值没有传递,我在分页的地方添加了

key=request("keyword")

sql = "select * from xinxi where biaoti like '%"&key&"%' order by id desc"

也不行呀,是不是我加错了,你能讲详细一点吗?谢谢

2005-12-09 19:54
快速回复:关于LIKE查询后分页的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031518 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved