搜索分页
<% keyword=trim(Request.Form("keyword")) if Request.Form("action")="title" then findword="title like ✀%"&keyword&"%✀"elseif Request.Form("action")="author" then findword="author like ✀%"&keyword&"%✀"elseif request("action")="keyword" then findword="keyword like ✀%"&keyword&"%✀"end if Set rs= Server.CreateObject("ADODB.Recordset") sql="select * from info WHERE "&findword&" ORDER BY info.time desc" rs.open sql,conn,1,1 rs.pagesize=2✀设置每页显示的个数 pagesize=rs.pagesize rscount=rs.Recordcount pagecount=rs.pagecount✀总页数 page=int(request("page")) if request("page")="" then page=1 rs.absolutepage=page✀设置当成前 url="search-result.asp?keyword="&keyword&"&action="&Request.Form("action")&"&" %> <table width="98%" height="25" border="0" align="center" cellspacing="0" class="td"> <tr> <td width="4%" height="25" align="left" bgcolor="#F1F7FC"><img src="image/class.gif" width="26" height="23"/></td> <td width="96%" align="left" bgcolor="#F1F7FC" class="font">搜索“<%response.Write keyword%>”文章列表</td> </tr> </table> <% if rs.eof and rs.bof then %> <table width="98%" height="28" border="0" align="center" cellpadding="0" cellspacing="0" class="td-dot"> <tr> <td width="3%" align="center"><img src="image/006.gif" width="10" height="10" /></td> <td>很抱歉,没有搜索到相关的文章!</td> </tr> </table><%else for i=1 to rs.pagesize if rs.eof then exit for✀如果指针到了最后,则退出循环 %> <table width="98%" height="28" border="0" align="center" cellpadding="0" cellspacing="0" class="td-dot"> <tr> <td width="3%" align="center"><img src="image/006.gif" width="10" height="10" /></td> <td width="77%"><a href="read-info.asp?id=<%=rs("id")%>" title="<%=rs("title")%>" target="_blank"><%=gotTopic(rs("title"),90)%></a></td> <td width="20%" align="center" class="f"><%=FormatDate(rs("time"),3)%></td> </tr> </table> <% rs.movenext next end if %> <table width="98%" height="30" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="bottom" class="page-f"><%call sub_page(page,url,pagecount,rscount,pagesize,"篇")%></td>分页子程序没有问题 </tr> </table> </td> </tr></table>能搜索到结果,但是分页到第二页就出现错误,提示Microsoft JET Database Engine (0x80040E14)WHERE 子句语法错误。/site/search-result.asp, 第 17 行。请高手相助。谢了