#12005/6/19 18:39:24
<% dim i,page,rs
set rs=server.CreateObject("adodb.recordset")
select case radiobutton
case "bookname"
rs.open "select * from book where bookname like '%"&key&"%'order by bookid",conn,1,1
case "isbn"
rs.open "select * from book where isbn = '"&key&"'order by bookid",conn,1,1
end select
if rs.eof and rs.bof then
response.write "<center><font color=red size=4>对不起,没有您查找的图书!</font>"
else
rs.PageSize = 22'每页显示记录数
if Not IsEmpty(Request("Page")) then '如果PAGE已经初始化...
Page = CInt(Request("Page")) '接收PAGE并化为数字型赋给PAGE变量
if Page > rs.PageCount then '如果接收的页数大于总页数
page=Rs.pageCount
rs.AbsolutePage = rs.PageCount '设置当前显示页等于最后页
else
rs.AbsolutePage = Page '显示当前页等于接收的页数
end if
else
Page = 1 '如果page未被初始化则设为1
End if
rs.AbsolutePage=page
%>
<table width="90%" height="25" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FAFAE5">
<tr bgcolor="ECECCD" class="zt">
<td width="19%" height="25" class="zt"><div align="center" class="zt4">
<p>ISBN</p>
</div></td>
<td width="43%" class="zt"><div align="center" class="zt4"> 书 名</div></td>
<td width="19%" class="zt"><div align="center" class="zt4">出版社</div></td>
<td width="19%" class="zt"><div align="center" class="zt4">定 价</div></td>
</tr>
</table>
<%do while not rs.eof%>
<table width="90%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#D8D8B4">
<tr bgcolor="F2F2D2" class="zt">
<td width="19%" height="23" bgcolor="#FAFAE5" class="zt"><div align="center"><%=rs("isbn")%></div></td>
<td width="43%" bgcolor="#FAFAE5" class="zt"><%=rs("bookname")%></td>
<td width="19%" bgcolor="#FAFAE5" class="zt"><div align="center"><%=rs("bookchuban")%></div></td>
<td width="19%" bgcolor="#FAFAE5" class="zt"><div align="center"><%=formatnumber(rs("dingjia"),2)&"元"%> </div></td>
</tr>
</table>
<%i=i+1
IF i>=rs.PageSize then exit do
rs.movenext
loop%>
<table align="center"><tr>
<td align="center"><form action="rearch" method="post" enctype="application/x-www-form-urlencoded" name="form3">
<span class="zt"> 共有<font color="#FF0000"><%=rs.recordcount%></font>条纪录 分为<font color="#FF0000"><%=rs.PageCount%></font>页 此为第<font color="#FF0000"><%=page%></font>页
<%if page>1 then%>
<a Href="research.asp?Page=<%=1%>" class="zt3">首页</a> <a Href="research.asp?Page=<%=page-1%>" class="zt3">上一页</a>
<%end if %>
<%if page<>rs.pagecount then %>
<a Href="research.asp?Page=<%=page+1%>" class="zt3">下一页</a> <a Href="research.asp?Page=<% = rs.PageCount%>" class="zt3" >尾页</a>
<% end if %><br><br>
</td>
</tr>
</table>
<%end if
rs.close
set rs=nothing%>
我点击下一页,就会出错:
ADODB.Recordset (0x800A0E78)
对象关闭时,不允许操作。