分享
 
 
 

ASP ACCESS 数据高级搜索 By Stabx

王朝asp·作者佚名  2006-05-05
窄屏简体版  字體: |||超大  

标题: ASP ACCESS 数据高级搜索 By Stabx

正文:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<!--#include file="Connections/conn.asp" -->

<!--#include virtual="include/globalabbr.asp"-->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">

<title><%=sitename_%></title>

<script LANGUAGE="JavaScript" TYPE="text/JavaScript">

<!--

function MM_jumpMenu(targ,selObj,restore){ //v3.0

eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

if (restore) selObj.selectedIndex=0;

}

//-->

</script>

</head>

<body>

<%

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'

' subject : ASP ACCESS 数据高级搜索

'

' author : Stabx<shawl.qiu@gmail.com>

'

' blog : http://blog.csdn.net/btbtd \ http://btbtd.exblog.jp/

'

' blog name : Phoenix.GI - P.GI

'

' date : 2006-5-5

'

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

%>

<!--#include virtual="include/top.asp"-->

<form ACTION="" METHOD="get" NAME="searchform" ID="searchform">

搜索:

<select NAME="searchoption" ID="searchoption">

<option VALUE="bytitle" <% if request("searchoption")="bytitle" then response.write "selected" end if%>> by title</option>

<option VALUE="bytag" <% if request("searchoption")="bytag" then response.write "selected" end if%>>by tag</option>

<option VALUE="bywriter" <% if request("searchoption")="bywriter" then response.write "selected" end if%>>by writer</option>

<option VALUE="bywww" <% if request("searchoption")="bywww" then response.write "selected" end if%>>by www</option>

</select>

<input NAME="findtext" TYPE="text" ID="findtext" <% if request("findtext")<>"" then response.write "value="&request("findtext") else response.Write "value=" end if%>>

<input TYPE="submit" NAME="Submit" VALUE="Submit">

<br>

精确:

<input NAME="findmode" TYPE="radio" VALUE="exacttrue" <% if request("findmode")="exacttrue" then response.write "CHECKED" end if%>>

:

<input NAME="findmode" TYPE="radio" VALUE="exactfalse" <% if request("findmode")<>"exacttrue" then response.write "CHECKED" end if%>>

: 否

<br>

顺序:

<input NAME="ordersc" TYPE="radio" VALUE="asc" <% if request("ordersc")="asc" then response.write "CHECKED" end if%>>

:升序

<input NAME="ordersc" TYPE="radio" VALUE="desc" <% if request("ordersc")<>"asc" then response.write "CHECKED" end if%>>

:降序

<br>

显示:

<input NAME="showarticles" TYPE="radio" VALUE="showtitle" <% if request("ordersc")="asc" or (request("ordersc")<>"showcontent" and request("ordersc")<>"titleandcontent") then response.write "CHECKED" end if%>>

:标题

<input NAME="showarticles" TYPE="radio" VALUE="titleandcontent" <% if request("showarticles")="titleandcontent" then response.write "CHECKED" end if%>>

:标题+内容

<br>

排序:

<input NAME="orderby" TYPE="checkbox" ID="orderby" VALUE="article.articleid" <% if join(filter(split(replace((request("orderby")),","," ")),"article.articleid"))="article.articleid" then

response.write "CHECKED"

elseif request("orderby")="" and request("searchoption")<>"bytag" then response.Write "checked" end if%>>

:文章ID

<input NAME="orderby" TYPE="checkbox" ID="orderby" VALUE="hits" <% if join(filter(split(replace((request("orderby")),","," ")),"hits"))="hits" then response.write "CHECKED" end if%>>

:点击

<input NAME="orderby" TYPE="checkbox" ID="orderby" VALUE="dateandtime" <% if join(filter(split(replace((request("orderby")),","," ")),"dateandtime"))="dateandtime" then response.write "CHECKED" end if%>>

:日期

<input NAME="orderby" TYPE="checkbox" ID="orderby" VALUE="classid" <% if join(filter(split(replace((request("orderby")),","," ")),"classid"))="classid" then response.write "CHECKED" end if%>>

:大类

<input NAME="orderby" TYPE="checkbox" ID="orderby" VALUE="nclassid" <% if join(filter(split(replace((request("orderby")),","," ")),"nclassid"))="nclassid" then response.write "CHECKED" end if%>>

:子类

</form>

<% if isempty(request("searchoption")) or isempty(request("findtext")) or request("findtext")="" and isempty(request("tag")) then

response.Write searchError_ %>

<% else %>

<% if len(request("findtext"))<=1 then

response.Write searchKeyless2_

else %>

<%

set rsFindSearchKey=server.CreateObject("adodb.recordset")

rsFindSearchKey.open "select * from search order by searchid desc ", MM_conn_String

RPP=50 '设置每页显示数目

I=1 '设置循环开始数目

showNumberLink_=10

toPage_="?searchoption="&request("searchoption")&"&findtext="&request("findtext")&"&findmode="&request("findmode")&"&ordersc="&request("ordersc")&"&showarticles="&request("showarticles")&"&pageview="

nonLinkColor_="#CCCCCC"

if request("searchoption")<>"" and request("searchoption")="bytitle" and request("searchoption")<>"bytag" and request("searchoption")<>"bywriter" and request("searchoption")<>"bywww" then

searchoption_="title"

elseif request("searchoption")<>"" and request("searchoption")<>"bytitle" and request("searchoption")="bytag" and request("searchoption")<>"bywriter" and request("searchoption")<>"bywww" then

searchoption_="tag"

elseif request("searchoption")<>"" and request("searchoption")<>"bytitle" and request("searchoption")<>"bytag" and request("searchoption")="bywriter" and request("searchoption")<>"bywww" then

searchoption_="writer"

elseif request("searchoption")<>"" and request("searchoption")<>"bytitle" and request("searchoption")<>"bytag" and request("searchoption")<>"bywriter" and request("searchoption")="bywww" then

searchoption_="www"

end if

if not isempty(request("ordersc")) and request("ordersc")<>"" and request("ordersc")="desc" then

sc_=request("ordersc")

else

sc_="asc"

end if

if not isempty(request("findmode")) and request("findmode")<>"" and request("findmode")="exacttrue" then

findtext_=ltrim(request("findtext"))

else

findtext_="%"&trim(request("findtext"))&"%"

end if

if isempty(request("orderby")) then

orderby_="article.articleid"

else

orderby_=request("orderby")

end if

Set rs = Server.CreateObject("ADODB.Recordset") '建立一个 rs 数据库查询

rs.CursorType = 1 '游标属性

rs.CursorLocation = 2 '游标位置

rs.LockType = 1 '定义数据库查询模式

if request("searchoption")="bytitle" or request("searchoption")="bywriter" or request("searchoption")="bywww" then

rs.open "select article.* from article where "&searchoption_&" like '"&findtext_&"' order by "&orderby_&" "&sc_,MM_conn_String

else

rs.open "select article.*,tag.* from article,tag where article.articleid=tag.articleid and "&searchoption_&" like '"&findtext_&"' order by "&orderby_&" "&sc_,MM_conn_String

end if

%>

<div CLASS="center"><% call fPageCount(RPP,rs,I,showNumberLink_,toPage_,nonLinkColor_)%></div>

<%

if rs.eof or rs.bof then

else

for i=1 to rpp

'替换查询关键字为高亮显示

titlereplacehl_=replace(rs("title"),request("findtext"),"<b class=b16>"&request("findtext")&"</b>",1,-1,1)

contentplacehl_=replace(rs("content"),request("findtext"),"<b class=b16>"&request("findtext")&"</b>",1,-1,1)

'第四个参数指定字符替换起始位置, 第五个指定每一个都要被替换, 第六个批定不区分大小写

if request("searchoption")="bytitle" or request("searchoption")="bywriter" or request("searchoption")="bywww" then

if isempty(request("showarticles")) or request("showarticles")="" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a>"

elseif request("showarticles")<>"" and request("showarticles")="showtitle" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a>"

elseif request("showarticles")<>"" and request("showarticles")="titleandcontent" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a><br/>"&contentplacehl_

end if

else

if isempty(request("showarticles")) or request("showarticles")="" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("article.articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a>"

elseif request("showarticles")<>"" and request("showarticles")="showtitle" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("article.articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a>"

elseif request("showarticles")<>"" and request("showarticles")="titleandcontent" then

showarticles_="<a HREF="&a1_&rs("classid")&a2_&rs("nclassid")&a3_&rs("article.articleid")&"#anchor TARGET=_blank>"&titlereplacehl_&"</a><br/>"&tagW_&rs("tag")&"<br/>"&contentplacehl_

end if

end if

if request("searchoption")="bywriter" then

subtitle_="<br/>"&author_&"<a href=mailto:"&rs("email")&">"&replace(rs("writer"),request("findtext"),"<b class=b16>"&request("findtext")&"</b>",1,-1,1)&"</a>"

elseif request("searchoption")="bywww" then

subtitle_="<br/>"&source_&"<a href="&rs("url")&">"&replace(rs("www"),request("findtext"),"<b class=b16>"&request("findtext")&"</b>",1,-1,1)&"</a>"

end if

%>

<div>

<div CLASS="floatRight">

[ <a HREF="<%=ddv_&rs("dateandtime")%>"><%=rs("dateandtime")%></a> ]

</div>

—— <%=showarticles_&subtitle_%>

<% if request("searchoption")="bytag" then

response.Write "<br/>"&tagW_

showtagItem_=replace(rs("tag"),","," ")

for each ti in SPLIT(showtagItem_)

response.Write "<a href="&t_&ti&"#anchor target=_blank>"&replace(ti,request("findtext"),"<b class=b16>"&request("findtext")&"</b>",1,-1,1)&"</a>"&"&nbsp;"

next

end if %>

</div>

</div>

<p/>

<%

rs.movenext

if rs.eof or rs.bof then exit for

next

end if

rs.close

set rs=nothing

%>

<%end if%>

<% end if %>

<!--#include file="include/bottom.asp"-->

</body>

</html>

update

发表日期: 2006-5-4

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有