|
主题: 帮我看看这个搜索程序问题倒底出在哪里,谢谢
|
micehui
职务:普通成员
等级:1
金币:0.0
发贴:28
|
#12003/12/3 17:25:31
以下是搜索框页面:
<!-- #include file="color.asp" --> <% response.write bbsid %> <body bgcolor="#ECE4D7"> <form name="form1" method="post" action="searcher.asp?bbsid=bbsids"> <table width="100%" border="0"> <tr> <td width="16%"> <div align="right"> <select name="searchertype"> <option selected value="title">按主题搜索</option> <option select value="author">按作者搜索</option> </select> </div> </td> <td width="84%"> <input type="text" name="keyword" size="10"> <input type="submit" name="searcher" value="搜索" style="background-color: <%=buttoncolor%>; color: <%=buttonfontcolor%>"></td> </tr> </table> </form> </body>
----------------------------------------------------------------------
以下是搜索显示页:
<% Response.Buffer = True %> <% if request("keyword")="" then response.redirect "error.asp?err_on=29" end if %> <!-- #include file="conn.asp" --> <!-- #include file="color.asp" --> <% set rs=server.createobject("adodb.recordset") sql="select * from bbs where bbsid="&request.querystring("boardid") rs.open sql,conn,1,1 if not rs.eof then dim bbsname,bbstypeid,bbsmaster,bbsjj,ubb,img,secret,speak,bbsgg bbsname=trim(rs("bbsname")) bbstypeid=trim(rs("bbstypeid")) bbsmaster=trim(rs("bbsmaster")) bbsjj=trim(rs("bbsjj")) ubb=trim(rs("ubb")) img=trim(rs("img")) secret=trim(rs("secret")) speak=trim(rs("speak")) bbsgg=trim(rs("bbsgg")) else response.redirect "error.asp?err_on=7" end if rs.close set rs=nothing if trim(secret)="y" then if request.cookies("zswmuser")="" then response.redirect "error.asp?err_on=28" end if end if %> <% if request.cookies("titleday")="" then response.cookies("titleday")="10000" else if request.form("titleday")<>"" then response.cookies("titleday")=request.form("titleday") end if end if %><html> <head> <title>main.asp</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <LINK href="include/style.css" type=text/css rel=stylesheet></head> <body bgcolor="<%=allbgcolor%>" text="#000000" topmargin="2"> <style>TABLE{BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:1px}TD{BORDER-RIGHT:0px;BORDER-TOP:0px}</style> <table width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="<%=mainbzgg%>" style="border-collapse: collapse"> <tr> <td bgcolor="#CCCCCC" height="17" colspan="2"> <div align="left"><b><font color="#006633">【<%=bbsname%>】</font></b>:<%=bbsjj%> <%if bbsgg<>"" then%> </div> </td> </tr> <tr> <td bgcolor="#FFFFFF" width="12%" height="17"><b>版主公告:</b></td> <td bgcolor="#FFFFFF" width="88%" height="17"><marquee><%=ubbcode(bbsgg)%> </marquee> <%end if%> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse"> <tr> <td height="17" width="51%">版主:<%=bbsmaster%> <%dim userlist1 userlist1=Application("userlist") for i=1 to 400 if userlist1(i,0)=bbsmaster and bbsmaster<>""then%> <font color="#FF0000"> <%response.write "在线"%> </font> <%end if next %> | <%if request.cookies("bbsmasterid")<>request.querystring("boardid") then%> <a href="masterlogin.asp?bbsid=<%=request.querystring("boardid")%>">版主登录</a> <%else if request.cookies("bbsmaster")="bbsmastertrue" and request.cookies("bbsmasterid")=request.querystring("boardid") then %> <a href="bbsmastergg.asp?boardid=<%=request.querystring("boardid")%>">发布公告</a>|<a href="bbsmastersm.asp?boardid=<%=request.querystring("boardid")%>">版面说明</a>|<a href="masterlogout.asp?boardid=<%=request.querystring("boardid")%>">退出管理模式</a> <%end if end if %> </td> <td height="17" colspan="2"> <div align="right"> <select name="titleday"> <option value="5">查看五天内的贴子</option> <option value="10">查看十天内的贴子</option> <option value="20">查看二十天内的贴子</option> <option value="30">查看三十天内的贴子</option> <option value="40">查看四十天内的贴子</option> <option value="50">查看五十天内的贴子</option> <option value="60">查看六十天内的贴子</option> <option value="10000">查看所有的贴子</option> </select> <input type="submit" name="Submit2" value="确定" style="background-color: <%=buttoncolor%>; color: <%=buttonfontcolor%>"> </div> </td> <form name="searcher" method="post" action="searcher.asp"> </form> </tr> <tr> <td height="17" width="51%"><a href="newpost.asp?bbsid=<%=request.querystring("boardid")%>"><b>发言</b></a><a href="seach.asp?bbsid=<%=request.querystring("boardid")%>">搜索</a> <%if request.cookies("zswmuser")="" then%> 您还没有登录社区[<a href="hylogin.asp?boardid=<%=request.querystring("boardid")%>">登录</a>]<b>[</b><a href="user/reg1.asp" target="_blank">注册</a><b>]</b> <%end if%> </td> <td height="17" width="9%"> <div align="center"><a href="javascript:this.location.reload()"><img src="images/shuaxin.gif" border="0" width="40" height="14"></a></div> </td> <td height="17" width="40%"> <div align="right"><a href="bbsjh.asp?boardid=<%=request.querystring("boardid")%>">本版精华</a> | <a href="userlist.asp?boardid=<%=request.querystring("boardid")%>">在线会员:<%=application("count")%>人</a></div> </td> </tr> </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="<%=alltable1%>"> <tr> <td height="25"><font color="#FFFFFF">搜索结果</font><a href="main.asp?boardid=<%=request("boardid")%>"><font color="#CCCCCC">←返回版面(<%=bbsname%>)</font></a></td> </tr> </table> <table width="100%" border="1" cellspacing="0" bordercolor="<%=allbgcolor%>"> <tr> <td width="45%" height="20" bgcolor="<%=bbsbg1%>"> <div align="center">标题</div> </td> <td width="8%" height="20" bgcolor="<%=bbsbg1%>"> <div align="center">回复</div> </td> <td width="17%" height="20" bgcolor="<%=bbsbg1%>"> <div align="center">作者</div> </td> <td width="30%" height="20" bgcolor="<%=bbsbg1%>"> <div align="center">发表时间</div> </td> </tr> <% if request("page")="" then page="1" else page=request("page") end if set rs=server.createobject("adodb.recordset") select case request("searchertype") case "title" sql="select * from bbstitle where title like '%"&request("keyword")&"%' and bbsid="&request("boardid")&" order by titleid desc" case "author" sql="select * from bbstitle where author='"&request("keyword")&"' and bbsid="&request("boardid")&" order by titleid desc" end select rs.open sql,conn,1,1 if not rs.eof then rs.pagesize=15 rs.Absolutepage=clng(page) if cstr(page)=cstr(rs.PageCount) and (rs.RecordCount mod rs.PageSize <> 0) then recend=rs.RecordCount mod rs.PageSize else recend=rs.PageSize end if for i=1 to recend %> <tr bgcolor="<%=bbsbg2%>"> <td width="50%" height="25"><img src="<%=trim(rs("icon"))%>"> <a href="view.asp?titleid=<%=trim(rs("titleid"))%>&boardid=<%=request("boardid")%>&page=<%=page%>&searchertype=<%=request("searchertype")%>&keyword=<%=trim(request("keyword"))%>&viewtype=searcher"><%=trim(rs("title"))%></a></td> <td width="8%" height="25"> <div align="center"><%=trim(rs("recount"))%></div> </td> <td width="17%" height="25"> <div align="center"><%=trim(rs("author"))%></div> </td> <td width="25%" height="25"><%=trim(rs("puttime"))%></td> </tr> <% rs.movenext next %> </table> <table border="0" width="100%" bgcolor="<%=alltable1%>"> <tr> <form name="form2" method="post" action="main.asp?boardid=<%=request.querystring("boardid")%>"> </form> <td> <div align="right"><font color="#FFFFFF">共搜索到贴子<%=rs.recordcount%>个, 目前<%=page%>/<%=rs.pagecount%>页</font></div> </td> <td width="5%" align="center"> <font color="#FFFFFF"> <% if page="1" then %> 首页 <%else%> </font><a href="searcher.asp?boardid=<%=request("boardid")%>&searchertype=<%=request("searchertype")%>&keyword=<%=trim(request("keyword"))%>"><font color="#FFFFFF">首页</font></a><font color="#FFFFFF"> <% end if %> </font></td> <td width="5%" align="center"> <font color="#FFFFFF"> <% if page="1" then %> 上页 <%else%> </font><a href="searcher.asp?boardid=<%=request("boardid")%>&page=<%=page-1%>&searchertype=<%=request("searchertype")%>&keyword=<%=trim(request("keyword"))%>"><font color="#FFFFFF">上页</font></a><font color="#FFFFFF"> <% end if %> </font></td> <td width="5%" align="center"> <font color="#FFFFFF"> <% if page=cstr(rs.pagecount) then %> 下页 <%else%> </font><a href="searcher.asp?boardid=<%=request("boardid")%>&page=<%=page+1%>&searchertype=<%=request("searchertype")%>&keyword=<%=trim(request("keyword"))%>"><font color="#FFFFFF">下页</font></a><font color="#FFFFFF"> <% end if %> </font></td> <td width="5%" align="center"> <font color="#FFFFFF"> <% if cstr(page)-cstr(rs.pagecount)=0 then%> 尾页 <% else %> </font><a href="searcher.asp?boardid=<%=request("boardid")%>&page=<%=rs.pagecount%>&searchertype=<%=request("searchertype")%>&keyword=<%=trim(request("keyword"))%>"><font color="#FFFFFF">尾页</font></a><font color="#FFFFFF"> <% end if else response.write "<tr><td>对不起,没有找到任何记录!</td></tr>" end if rs.close set rs=nothing conn.close set conn=nothing %> </font></td> </tr> </table> </body> </html> <% Response.Flush %>
---------------------------
这个问题倒底出在哪里,为什么总是显示:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e21'
ODBC 驱动程序不支持所需的属性。
/xxbbs2/searcher.asp, 行12
|
缺缺
职务:管理员
等级:8
金币:41.0
发贴:9620
|
#22003/12/3 19:28:53
<form name="form1" method="post" action="searcher.asp?bbsid=bbsids">? 很明显bbsidid传递不对 也许是searcher.asp?bbsid=<%=bbsids%>
|
janlay
职务:管理员
等级:7
金币:28.0
发贴:7244
|
#32003/12/3 20:11:30
结合 sql="select * from bbs where bbsid="&request.querystring("boardid") 来看,应是 <form name="form1" method="post" action="searcher.asp?boardid=<%=bbsids%>"> 建议先吃透再改
|
micehui
职务:普通成员
等级:1
金币:0.0
发贴:28
|
#42003/12/3 22:46:58
楼上的好像还是不对,提示同样的错误,第12行出错,是不是在searcher.asp的第12行改呢? 第12行是: rs.open sql,conn,1,1
|
缺缺
职务:管理员
等级:8
金币:41.0
发贴:9620
|
#52003/12/3 22:56:18
代码是你自己写的么?
你知道<form name="form1" method="post" action="searcher.asp?bbsid=bbsids"> 里面的bbsid=bbsids是什么意思么?
|
micehui
职务:普通成员
等级:1
金币:0.0
发贴:28
|
#62003/12/4 8:42:11
不是自己写的!
|