标题:asp+access搜索后怎样才能保留全部的搜索条件
只看楼主
cwang2100
Rank: 2
等 级:论坛游民
帖 子:12
专家分:12
注 册:2010-3-16
结帖率:100%
已结贴  问题点数:10 回复次数:1 
asp+access搜索后怎样才能保留全部的搜索条件
asp网页,上面一个搜索条,下面显示搜索结果。输入搜索条件后,点击“搜索”按钮,然后页面刷新了一下,下面就显示出了搜索的结果,但是搜索条件却全都被清空了,我想在点击按钮之后即出现了结果,而刚刚输入的搜索条件也能保留下来,就像百度搜索那样.怎样才能实行呢?我是菜鸟最好能给完整代码.,谢谢!!!



如果四个条件都选的话就全都保存下来.

代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文件</title>
</head>
<body bgcolor="#ffffff">

<table width=690 border="0" cellspacing="0" bordercolorlight="#4DA6FF" bordercolordark="#ECF5FF" width="100%" style="word-break:break-all" align="center">
<tr>
<td width="580" align="center" colspan="7">
<form method="POST" name="form1" action=sou.asp>
<P><font style="font-size: 14px " color="0000ff" align="left">搜索内容</font>
<input type="text" name="cxsj" size="15">
<select name="bb" id="Searc_bb">
<option selected="selected" value="">所在属省份</option>
<option value="广东">广东</option>
<option value="广西">广西</option>

<option value="上海">上海</option>
</select>
<select name="dd" id="Search_dd">
<option selected="selected" value="">按等级</option>
<option value="10001">一级</option>
<option value="251">二级</option>
<option value="250">三级</option>
</select>
<select name="SearchUC" id="Search_UC">
<option selected="selected" value="">默认排序</option>
<option value="251">按价格从低到高</option>
<option value="99999991">等级从高到低</option>
<option value="250">按价格从高到低</option>
</select>
<input type="submit" value="本站搜索" name="B1">
</form>
</tr>
</table>

<TABLE width=890 bgColor=#FFFFFF border=0 bordercolor="0" align="center">
<TR>
<TD>

<%

cxsj=request.form("cxsj")
bb=request.form("bb")
dd=request.form("dd")
SearchUC=request.form("SearchUC")
dim pageCount
page = cint(request("page"))
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
conn.open "DBQ=" & server.mappath("data.mdb") & ";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"

sql="select * from tade where 1=1 "
if cxsj <> "" then
sql=sql&"and aa like '%"&cxsj& "%'"
end if
if bb<>"" then
sql=sql&"and bb = '%"&bb&"%'"
end if
if dd<>"" then
sql=sql&"and dd = '%"&dd&"%'"
end if
if SearchUC="" then
sql=sql&" order by id desc"
end if
if SearchUC="251" then
sql=sql&" order by cc asc"
end
if SearchUC="99999991" then
sql=sql&" order by dd desc"
end

if SearchUC="250" then
sql=sql&" order by cc desc"
end

rs.open sql,conn,3,3

if rs.bof then
errmsg=errmsg+"<br>"+"<li>"+keyword+"没有记录,请返回!!"
response.write errmsg
response.end
end if

RS.PageSize=8
pageCount = cint(rs.pageCount)

if page = 0 then
page =1
end if
RS.AbsolutePage = page
x=1

WHILE NOT RS.EOF AND NumRows<RS.PageSize
%>

<tr>

<td width="160">

<div align="center"><a target="_blank" href="<%=rs("aa")%>">

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


<%RS.MoveNext
NumRows=NumRows+1
WEND%>


搜索更多相关主题的帖子: 条件 搜索 asp access 
2010-03-18 18:04
aspic
Rank: 17Rank: 17Rank: 17Rank: 17Rank: 17
等 级:贵宾
威 望:51
帖 子:2258
专家分:8050
注 册:2008-2-18
得分:7 
通过参数传递呗
2010-03-18 18:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-299823-1-1.html




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

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