| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 369 人关注过本帖
标题:[求助]很急,发完贴,为什么没人理呢??!!!我的搜索问题
只看楼主 加入收藏
io5200
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-10-7
收藏
 问题点数:0 回复次数:3 
[求助]很急,发完贴,为什么没人理呢??!!!我的搜索问题

'-------------------搜索--------------------- <form name="form1" method="post" action="search.asp"> <td width="122"> 输入要搜索的内容: </td> <td width="172"> <input name="keyin" type="text" id="keyin"></td> <td width="107"><select name="title" size="1" id="title"> <option value="1" selected>全部关键字</option> <option value="2">按标题搜索</option> <option value="3">按内容搜索</option> </select></td> <td width="140"><input name="I1" type="image" class="timtd" src="../images/button-tijiao.gif" width="70" height="18" border="0"></td> </form> '------------------搜索显示代码----------- <%'开始分页 Const MaxPerPage=15 dim totalPut dim CurrentPage dim TotalPages dim j dim sql1 if Not isempty(request("page")) then currentPage=Cint(request("page")) else currentPage=1 end if

typer=trim(request("title")) keyin=trim(request("keyin")) select case typer case "1" sql1="title & content lIKE '%"&keyin&"%' " case "2" sql1="title lIKE '%"&keyin&"%' " case "3" sql1="content lIKE '%"&keyin&"%'" end select

set rs=server.CreateObject("adodb.recordset") rs.open "select * from tlt where what='我的一个条件' and "&sql1&"",conn,1,1 if rs.eof And rs.bof then Response.Write "<p align=center> 对不起,没有查讯到!</p><br>" 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 showContent showpage totalput,MaxPerPage,"search.asp" else if (currentPage-1)*MaxPerPage<totalPut then rs.move (currentPage-1)*MaxPerPage showContent showpage totalput,MaxPerPage,"search.asp" else currentPage=1 showContent showpage totalput,MaxPerPage,"search.asp" end if end if end if

sub showContent dim i i=0 %> <%do while not rs.eof%> '-----------------显示---------------- <table border="0" cellspacing="0" width="100%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0" bgcolor="#000000"> <tr bgcolor="#FFFFFF"> <td width="470" height="23">   <A href="printpage.asp?id=<%=rs("id")%>" target=_blank><%=rs("title")%></A> <font color="#cccccc">[<a href="printpage.asp?typ=<%=rs("typ")%>"><font color="#cccccc"><%=rs("typ")%></font></a>]</font></td> <td width="100">【<%=rs("date")%>】</td> </tr> <tr bgcolor="#FFFFFF"> <td colspan="2"><hr width="90%" size=1 style="border:1px dotted #038103;"></td> </tr> </table> '--------------------分页--------------- <%i=i+1 if i>=MaxPerPage then Exit Do rs.movenext loop rs.close set rs=nothing%> <% 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 "<form method=Post action="&filename&"?keyin="&keyin&"&title="&typer&">" Response.Write "<p align='center' class='contents'> " If CurrentPage<2 Then Response.Write "<font class='contents'>首页 上一页</font> " Else Response.Write "<a href="&filename&"?page=1&keyin="&keyin&"&title="&typer&" class='contents'>首页</a> " Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&keyin="&keyin&"&title="&typer&" class='contents'>上一页</a> " End If

If n-currentpage<1 Then Response.Write "<font class='contents'>下一页 尾页</font>" Else Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&keyin="&keyin&"&title="&typer&" class='contents'>" Response.Write "下一页</a> <a href="&filename&"?page="&n&"&keyin="&keyin&"&title="&typer&" class='contents'>尾页</a>" End If Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> " Response.Write "<font class='contents'> 共查讯到"&totalnumber&"条 " Response.Write "<font class='contents'>转到:</font><input CLASS='wenbenkuang' type='text' name='page' size=2 maxlength=8 class=smallInput value="&currentpage&">" Response.Write "&nbsp;<input type='submit' CLASS='go-wenbenkuang' class='contents' value='GO' name='cndok'></form>" End Function %> '---------------------------------------------------------------------------------------------- 请各位高手指点一下,为什么我的显示出来会是这个样子呢??也显示查询到的记录,但是分页的时候就显示下面的样子了,不知道为什么,是我的多条件查询写的不对,还是我的分页有毛病呢?我很菜的~~谢谢同志们拉~~ 首页 上一页 下一页 尾页 页次:1/0页 共查讯到0条 转到: rs.open "select * from tlt where what='我的一个条件' and "&sql1&"",conn,1,1 问题是:假如我把上边的" what='我的一个条件' " 这个条件去掉,就能用~,是我的这个条件加的有问题吗

搜索更多相关主题的帖子: 搜索 
2005-10-08 11:15
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
那你就去掉不就行了
2005-10-08 12:32
io5200
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-10-7
收藏
得分:0 
那个条件是必须有的,明白吗,楼上的高手有没有办法呢??没有那个条件不就成了全部搜索了嘛!!

2005-10-08 14:36
io5200
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2005-10-7
收藏
得分:0 
我知道怎么回事了,很高兴~~~呵呵~~~

2005-10-08 16:31
快速回复:[求助]很急,发完贴,为什么没人理呢??!!!我的搜索问题
数据加载中...
 
   



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

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