| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 768 人关注过本帖
标题:[求助]这段ASP站内搜索的代码无法精确搜索?
取消只看楼主 加入收藏
ecolor0918
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-1-26
收藏
 问题点数:0 回复次数:0 
[求助]这段ASP站内搜索的代码无法精确搜索?

请高手帮我看看这段站内搜索的代码
如何修改才能使搜索精确呢?
就是能够按照文章的标题进行搜索,而且可以同时搜索几个关键字
谢谢!


<!--#include file="head.asp" -->
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<TABLE width=778 border=0 align="center" cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width="100%"> <TABLE cellSpacing=0 cellPadding=0 width=778 align=center border=0>
<TBODY>
<TR bgColor=#ffffff>
<TD colSpan=3 height=2></TD>
</TR>
<TR>

<TD width="19" height=22 align=right><img src="Img/Ew_Guide.gif" width="11" height="11"></TD>

<TD width="748"><FONT color=#333333>&nbsp;您的位置:&nbsp;</FONT><a href="Default.asp">网站的首页</a></TD>
<TD width="11">&nbsp;</TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=778 border=0>
<TBODY>
<TR>
<TD vAlign=top colSpan=2> <table width="778" border="0" align="center" cellpadding="0" cellspacing="0" style="BORDER-Top: #d8d8d8 1px solid;BORDER-RIGHT: #d8d8d8 1px solid;BORDER-left: #d8d8d8 1px solid">
<tr>
<td width="28" height="22" bgcolor="#FFFFFF" align="right">
<img src="Img/Announce.gif" width="18" height="24"></td>
<td width="69" bgcolor="#FFFFFF" align="right">滚动公告:</td>
<td width="653" bgcolor="#FFFFFF">
<% Call Marquee()%>
</td>
<td width="26" bgcolor="#FFFFFF" valign="top" align="right"><img src="Img/Ew-Ar.gif" width="13" height="11"></td>
</tr>
</table></TD>
</TR>
<TR>
<TD style="BORDER-RIGHT: #d8d8d8 1px solid;BORDER-left: #d8d8d8 1px solid" vAlign=top width=185
bgColor=#f6f6f6>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD background=""> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height=34><TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="Img/Ew_Menu212.gif">
<TBODY>
<TR>
<TD height=32><strong>&nbsp;&nbsp;&nbsp;
用 户 登 陆</strong></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD height=40><TABLE width=95% height="100" border=0 align=center cellPadding=0 cellSpacing=1 bgColor=#e8e8e8>
<TBODY>
<TR>
<TD height="53" bgColor=#FFFFFF> <% Call UserLogin() %> </TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="Img/Ew_Menu212.gif">
<TBODY>
<TR>
<TD height=32><strong>&nbsp;&nbsp;&nbsp; 热 门 信 息</strong></TD>
</TR>
</TBODY>
</TABLE>

</TD>
</TR>
<TR>
<TD vAlign=top><TABLE cellSpacing=0 cellPadding=5 width=99% align=center bgColor=#e8e8e8 border=0>
<TBODY>
<TR>
<TD width="100%" bgColor=#FFFFFF> <% Call Ew_ShowInfo(1,10,26,0,0) %> </TD>
</TR>
</TABLE></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD>
<TABLE width="100%" border=0 cellPadding=0 cellSpacing=0 background="Img/Ew_Menu212.gif">
<TBODY>
<TR>
<TD height=32><strong>&nbsp;&nbsp;&nbsp; 网 站 调 查</strong></TD>
</TR>
</TBODY>
</TABLE>

</TD>
</TR>
<TR>
<TD vAlign=top><TABLE style="WORD-BREAK: break-all" height="100%" cellPadding=4 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top height=80> <TABLE width=99% height="100%" border=0 align=center cellPadding=0 cellSpacing=1 bgColor=#e8e8e8>
<TBODY>
<TR>
<TD width="100%" height="52" bgColor=#FFFFFF>
<% Call Ew_FlashVote() %>
</TD>
</TR>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD></TD>
</TR>
<TR>
<TD></TD>
</TR>
</TBODY>
</TABLE></TD>
<TD vAlign=top align=left width=593 style="BORDER-RIGHT: #d8d8d8 1px solid">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form name="form" method="post" action="Search.asp">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<TR>
<TD align=middle width=55 background=Img/Ew_BarBg.gif height=34><img src="Img/Ew_Bar.gif" width="55" height="34"></TD>
<TD width="535" background=Img/Ew_BarBg.gif> &nbsp;&nbsp; 查找关键字:
<input name="txtitle" type="text" class=smallInput id="txtitle" size="13">
&nbsp;
<input type="submit" value="查 询" name="title" class="buttonface">
</TD>
</TR>
</TBODY>
</TABLE>
</form></td>
</tr>
</table>
<%
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim txtitle

if not isempty(request("page")) then
currentPage=Trim(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="100%" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> <%
txtitle=request.form("txtitle")
Set rs= Server.CreateObject("ADODB.Recordset")
sql="select * from info where"
if txtitle<>"" then
sql=sql&" title like '%"&txtitle&"%' or content like '%"&txtitle&"%'"
else
sql = "select * from info order by id desc "
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<br><br><p align='center'>没有找到任何信息...</p>"

else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"Search.asp"
showContent
showpage totalput,MaxPerPage,"Search.asp"
end if
end if
rs.close
end if

set rs=nothing
conn.close
set conn=nothing

sub showContent
dim i
i=0
%>
<br>
<br>
<table width="94%" border="0" align="center" cellpadding="0" cellspacing="1" bordercolorlight="#cccccc" bordercolordark="#FFFFFF" bgcolor="#CCCCCC">
<tr bgcolor="#D8D8D8">
<td width="66" height="22" align="center">ID</td>
<td width="486" align="center" bgcolor="#D8D8D8">信
息 标 题</td>
</tr>
<%do while not rs.eof%>
<tr bgcolor="#FFFFFF">
<td width="66" height="22" bgcolor="#FFFFFF">
<p align="center"><%=rs("ID")%></td>
<td> <p align="left">&nbsp;&nbsp;<a href="ViewInfo.asp?id=<%=rs(0)%>"><%=rs("title")%></a></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr bgcolor="#D8D8D8">
<td height="22" colspan="2">
<div align="right"> </div></td>
</tr>
</table>
<%
end sub

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<p align='center'>&nbsp;"
if CurrentPage<2 then
response.write "首页 上一页&nbsp;"
else
response.write "<a href="&filename&"?page=1>首页</a>&nbsp;"
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a>&nbsp;"
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "&nbsp;页次:<strong>"&CurrentPage&"/"&n&"</strong>页"
response.write "&nbsp;共<b>"&totalnumber&"</b>篇文章 <b>"&maxperpage&"</b>篇文章/页"

end function

%> </td>
</tr></form>
</table> </td>
</tr>
</table></TD>
</TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<!--#include file="Bottom.asp" -->
</BODY></HTML>


搜索更多相关主题的帖子: 代码 搜索 ASP 
2006-01-26 09:36
快速回复:[求助]这段ASP站内搜索的代码无法精确搜索?
数据加载中...
 
   



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

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