<!--#include file="conn.asp"-->
<%
name=Request.form("name")
keyword=request.form("keyword")
%>
<p class="STYLE2">搜索: <font color="green"><%=name%></font> 中的关键字: <span style="background-color:#FFFF00"><%=keyword%></span><br>
<br>
<br>
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from yonghu where name like '%"&keyword&"%' ",conn,1,1
page = request.QueryString("page")
id = request.QueryString("id")
if not isempty(request.QueryString("page")) then
page = cint(request.QueryString("page"))
else
page = 1
end if
if rs.eof and rs.bof then
page=1
maxpage=1
else
rs.pagesize=3
icount=rs.recordcount
ipagesize=rs.pagesize
maxpage=rs.pagecount
page=request("page")
if not isnumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.absolutepage=page
if page=maxpage then
x=iconut-(maxpage-1)*ipagesize
else
x=ipagesize
end if
x=x-4
if page<>1 then
for i=0 to x
rs.movenext
next
end if
end if
%>
<%
if rs.eof then
response.Write("没有搜索到相关内容<br><br><a href='javascript:history.go(-1)'>返回重新搜索</a>")
else
response.Write("相关内容如下:<br><br>")
end if
%>
<%
dim x
x=0
do while not rs.eof
%>
</p>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="38"><%=rs("name")%>
</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<%
x=x+1
if x>2 then exit do
rs.movenext
loop%>
<%response.Write"共"&rs.recordcount&"条记录"%>
共<%=maxpage%>页 第<%=page%>页
<%if page=1 then
response.Write"[上一页]"
else
%>
[<a href="?page=<%=page-1%>&id=<%=id%>">上一页</a>]
<%end if
if page=rs.pagecount or page=0 then
response.Write"[下一页]"
else%>
[<a href="2.asp?page=<%=page+1%>&id=<%=id%>"> 下一页</a>]
<%end if
if page>1 then %>
[<a href=2.asp?pag=1&id=<%=id%>>首页</a>]
<%else
response.Write"[首页]"
end if
if page<rs.pagecount then %>
[<a href=2.asp?page=<%=int(rs.pagecount)%>&id=<%=id%>>尾页</a>]
<%else
response.Write"[尾页]"
end if
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
这什么我点下一页的时候会出现数据库中的所有内容都显示出来。而不是只显示搜索的内容。