| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 974 人关注过本帖
标题:asp搜索纪录分页问题
只看楼主 加入收藏
ali218
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-5-13
收藏
 问题点数:0 回复次数:6 
asp搜索纪录分页问题

我有个自己编的ASP程序,如果搜索找到有下一页的纪录时(比如3页纪录)按“下一页”它直接打开整个纪录的第二页,而不是搜索找到的第二页下面是代码,我加keyword=<%=keyword%>这个,也没用,请高手帮忙

<!--#include file="conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<link rel="stylesheet" href="Admin_STYLE.CSS">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language = "JavaScript">
function CheckForm()
{
if (document.search.keyword.value=="")
{
alert("搜索关键字不能为空!");
document.search.keyword.focus();
return false;
}
if (document.search.keyword.value=="输入搜索关键字")
{
alert("请输入搜索关键字!");
document.search.keyword.focus();
return false;
}
return true;
}
</script>
</head>

<body bgcolor="#DDDDDD" topmargin="0" leftmargin="0">

<div align="center" style="border-bottom-style: solid; border-bottom-width: 1px; padding-bottom: 1px">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#006D91" width="100%">
<tr>
<td width="100%" bgcolor="#FFFFFF">
<table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" >
<tr>
<td width="99%" class="topbg" style="background-image: url('Images/topBar_bg.gif')">
<b>会员卡挂失管理</b></td></tr></table>

<%
page = request.querystring("page")
keyword1 = request.form("keyword")
if keyword1="已" or keyword1="已补办" then
keyword = "补办"
else
keyword = keyword1
end if
serch1 = request.form("serch1")
if keyword <> "" then
sql = "select * from XFL where yuankahao like '%"&keyword&"%' or shenqingren like '%"&keyword&"%' or zhengjianhao like '%"&keyword&"%' or jin_e like '%"&keyword&"%'or shenqingriqi like '%"&keyword&"%'or jingshouren like '%"&keyword&"%'or xiankahao like '%"&keyword&"%'or heduijin_e like '%"&keyword&"%'or bubanren like '%"&keyword&"%'or best like '%"&keyword&"%'or bubanriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="原卡号" then
sql ="select * from XFL where yuankahao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="申请人" then
sql ="select * from XFL where shenqingren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="证件号" then
sql ="select * from XFL where zhengjianhao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="金额" then
sql ="select * from XFL where jin_e like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="申请日期" then
sql ="select * from XFL where shenqingriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="经手人" then
sql ="select * from XFL where jingshouren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="现卡号" then
sql ="select * from XFL where xiankahao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="核对金额" then
sql ="select * from XFL where heduijin_e like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="补办日期" then
sql ="select * from XFL where bubanriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="补办人" then
sql ="select * from XFL where bubanren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="操作" then
sql ="select * from XFL where best like '%"&keyword&"%'order by id desc"
else
sql = "select * from XFL where yuankahao like '%"&keyword&"%' or shenqingren like '%"&keyword&"%' or zhengjianhao like '%"&keyword&"%' or jin_e like '%"&keyword&"%'or shenqingriqi like '%"&keyword&"%'or jingshouren like '%"&keyword&"%'or xiankahao like '%"&keyword&"%'or heduijin_e like '%"&keyword&"%'or bubanren like '%"&keyword&"%'or best like '%"&keyword&"%'or bubanriqi like '%"&keyword&"%'order by id desc"
end if
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof or rs.bof then
%>
<p style="margin-top: 2" align=center><br><br><br><font color="#FF0000">没有找到相关记录
<a href="Search.asp"><font color="#0000FF">重新搜索</font></a></font><br><br><br>

<%
else
rs.pagesize = "20"
if page = "" or page < "1" then
page = "1"
end if
if rs.pagecount > "0" then
rs.absolutepage = page
end if
i = "0"
%>
<center><br>
<table border="1" cellpadding="0" style="border-collapse: collapse; border-right-width:0px" bordercolor="#111111" width="331" height="62" bgcolor="#EFEFEF">
<form method="post" action="Search.asp" name="search" onSubmit="return CheckForm();">
<tr>
<td width="111" align="center" style="border-left: 1px solid #111111; border-right-style: none; border-right-width: medium; border-top: 1px solid #111111; border-bottom: medium none #111111; "><p style="margin-top: 2">
添入关键字&nbsp;</p></td>
<td width="110" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top: 1px solid #111111; border-bottom-style: none; border-bottom-width: medium"><input type="text" size="20" name="keyword" style="width: 100; height: 16" onmouseover="this.style.borderColor='#486841';this.style.backgroundColor='#E2F1A6'" onmouseout="this.style.borderColor='#006D91';this.style.backgroundColor='#EFEFEF'"></td>
<td width="110" align="center" rowspan="2" style="border-left-style: none; border-left-width: medium; border-right-color: #111111; border-right-width: 1px; border-top-color: #111111; border-top-width: 1px; border-bottom-color: #111111; border-bottom-width: 1px">
<input border="0" height="16" name="imageField" src="images/20.gif" type="image" width="47"></td>
</tr>
<tr>
<td width="111" align="center" style="border-left: 1px solid #111111; border-right-style: none; border-right-width: medium; border-top: medium none #111111; border-bottom: 1px solid #111111">
高级搜索</td>
<td width="110" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: 1px solid #111111">
<SELECT name="serch1" font face="宋体" style="font-size: 9pt" size="1">
<option selected>选择搜索范围</option>
<option>原卡号</option>
<option>申请人</option>
<option>证件号</option>
<option>金额</option>
<option>申请日期</option>
<option>经手人</option>
<option>现卡号</option>
<option>核对金额</option>
<option>补办日期</option>
<option>补办人</option>
<option>操作</option>
</td>
</tr>
</form>
</table><br>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="3">
<tr>
<td width="100%"></td>
</tr>
</table>

<table border="0" width="100%" cellspacing="1" cellpadding="0" id="table1" height="29"><tr>
<td width="41" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">序号</font></td>
<td width="45" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">原卡号</font></td>
<td width="140" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">申请人</font></td>
<td width="166" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">证件号</font></td>
<td width="55" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">金额</font></td>
<td width="76" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">申请日期</font></td>
<td width="102" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#000000">经手人</font></td>
<td width="45" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#0000FF">现卡号</font></td>
<td width="62" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#0000FF">核对金额</font></td>
<td width="73" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#0000FF">补办日期</font></td>
<td width="108" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#0000FF">补办人</font></td>
<td width="62" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px" bgcolor="#DDDDDD">
<font color="#FF0000">操作</font></td>
</tr>

<%
do while not rs.eof or rs.bof
i = i + 1
if i > rs.pagesize then
exit do
end if
%>
<tr>
<td width="41" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("id")%></td>
<td width="36" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("yuankahao")%></td>
<td width="140" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("shenqingren")%></td>
<td width="166" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("zhengjianhao")%></td>
<td width="55" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("jin_e")%></td>
<td width="76" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("shenqingriqi")%></td>
<td width="102" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><%=rs("jingshouren")%></td>
<td width="45" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><font color="#0000FF"><%=rs("xiankahao")%></font></td>
<td width="62" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><font color="#0000FF"><%=rs("heduijin_e")%></font></td>
<td width="73" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><font color="#0000FF"><%=rs("bubanriqi")%></font></td>
<td width="108" align="left" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px"><font color="#0000FF"><%=rs("bubanren")%></font></td>
<td width="62" align="center" height="27" bordercolor="#006D91" style="border-style: solid; border-width: 1px">
<%

if rs("best")="办理" then
%>
<a href="Search.asp?action=modifymovie&movieid=<%=rs("id")%>">
<font color="#0000FF">办理</font></a>
<%
Elseif rs("best")="补办" then
response.write"<font color='#FF0000'>已补办</font>"
%>
<%
Else
response.write"<font color='#000000'>解除</font>"
End If
%>
<%if session("name")="gialot" then%><br><a href="Search.asp?action=delmovie&movieid=<%=rs("id")%>"><font color="#FF00FF">删除</font></a><%end if%></td>
</tr>
<%
rs.movenext
loop
%>
</table>


<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#006D91" width="100%">
<tr>
<td width="100%" bgcolor="#EFEFEF" align="center"><p style="margin-top: 2">[第<%=page%>页/共<%=rs.pagecount%>页] <%if page = "1" then%>[首页] [上一页] <%else%>[<a href="Search.asp">首页</a>] [<a href="Search.asp?page=<%=page-1%>">上一页</a>] <%end if%><%if rs.pagecount-page < 1 then%>[下一页] [尾页]<%else%>[<a href="Search.asp?page=<%=page+1%>&keyword=<%=keyword%>">下一页</a>] [<a href="Search.asp?page=<%=rs.pagecount%>">尾页</a>]<%end if%></td>
</tr>
</table>
<%

end if
rs.close
set rs = nothing
%>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="3">
<tr>
<td width="100%"></td>
</tr>
</table>

</td>
</tr>
</table>



</center>
</div>

</body>

</html>
<%

conn.close
set conn = nothing
%>

搜索更多相关主题的帖子: 纪录 asp 搜索 keyword 
2007-06-15 20:44
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
Search.asp?page=&lt;%=page-1%&gt;&amp;keyword=&lt;%=keyword%&gt;加在上一页和下一页的连接上。
2007-06-15 20:50
ali218
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-5-13
收藏
得分:0 
好像你没有看到上面的代码 本身就 有>Search.asp?page=<%=page+1%>&keyword=<%=keyword%>">下一页</a>


这样也不行

2007-06-15 23:34
xuecg
Rank: 1
等 级:新手上路
帖 子:65
专家分:0
注 册:2007-5-13
收藏
得分:0 
你的page变量有问题吧,你都是用字符型赋值
2007-06-15 23:41
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
定义一个变量,value值为空,随着sql的变化而改变,把这个参数值传到分页程序里
比如说
dim SearchStr
SearchStr=""
if keyword <> "" and serch1 ="原卡号" then
sql ="select * from XFL where yuankahao like '%"&keyword&"%'order by id desc"
SearchStr = SearchStr &"&serch1="&"yuankahao"&"&keyword="&keyword
elseif keyword <> "" and serch1 ="申请人" then
sql ="select * from XFL where shenqingren like '%"&keyword&"%'order by id desc"
SearchStr = SearchStr &"&serch1="&"shenqingren"&"&keyword="&keyword
.......
Search.asp?page=<%=page+1%><%=SearchStr%>">下一页</a>
2007-06-16 04:22
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 

需要传递一个参数过去的!


程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2007-06-16 10:01
ali218
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-5-13
收藏
得分:0 
我按照楼上方法不行的,麻烦你亲自动手改一下好吗
<%
page = request.querystring("page")
keyword1 = request.form("keyword")
if keyword1="已" or keyword1="已补办" then
keyword = "补办"
else
keyword = keyword1
end if
serch1 = request.form("serch1")
if keyword <> "" then
sql = "select * from XFL where yuankahao like '%"&keyword&"%' or shenqingren like '%"&keyword&"%' or zhengjianhao like '%"&keyword&"%' or jin_e like '%"&keyword&"%'or shenqingriqi like '%"&keyword&"%'or jingshouren like '%"&keyword&"%'or xiankahao like '%"&keyword&"%'or heduijin_e like '%"&keyword&"%'or bubanren like '%"&keyword&"%'or best like '%"&keyword&"%'or bubanriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="原卡号" then
sql ="select * from XFL where yuankahao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="申请人" then
sql ="select * from XFL where shenqingren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="证件号" then
sql ="select * from XFL where zhengjianhao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="金额" then
sql ="select * from XFL where jin_e like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="申请日期" then
sql ="select * from XFL where shenqingriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="经手人" then
sql ="select * from XFL where jingshouren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="现卡号" then
sql ="select * from XFL where xiankahao like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="核对金额" then
sql ="select * from XFL where heduijin_e like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="补办日期" then
sql ="select * from XFL where bubanriqi like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="补办人" then
sql ="select * from XFL where bubanren like '%"&keyword&"%'order by id desc"
elseif keyword <> "" and serch1 ="操作" then
sql ="select * from XFL where best like '%"&keyword&"%'order by id desc"
else
sql = "select * from XFL where yuankahao like '%"&keyword&"%' or shenqingren like '%"&keyword&"%' or zhengjianhao like '%"&keyword&"%' or jin_e like '%"&keyword&"%'or shenqingriqi like '%"&keyword&"%'or jingshouren like '%"&keyword&"%'or xiankahao like '%"&keyword&"%'or heduijin_e like '%"&keyword&"%'or bubanren like '%"&keyword&"%'or best like '%"&keyword&"%'or bubanriqi like '%"&keyword&"%'order by id desc"
end if
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof or rs.bof then
%>

2007-06-16 18:28
快速回复:asp搜索纪录分页问题
数据加载中...
 
   



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

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