
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录
<!--#includefile="conn.asp"--><%setrs=server.createobject("adodb.recordset")sql="sele...
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select * from class where id="&request.querystring("id")
rs.open sql,conn,1,1
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=rs("class")%>-软件</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12pt}
a:link { font-size: 9pt; text-decoration: none; color: blue; }
a:visited { font-size: 12pt; text-decoration: none; color: Purple; }
body {
background-color: #94C4C5;
}
-->
</style>
</head>
<body>
<div align="center">
<table width="768" border="0">
<!--DWLayoutTable-->
<tr>
<td height="14" colspan="3" valign="top" bgcolor="#6F79C4"><div align="center" class="STYLE2"><a href="index.asp" class="STYLE2"></a><%=rs("class")%></div></td>
</table>
<table width="763" border="0">
<!--DWLayoutTable-->
<%
set rsc=server.createobject("adodb.recordset")
sqlc="select * from introduce where class='"&rs("class")&"' order by id desc"
rsc.open sqlc,conn,1,1
dim pageCount
page = cint(request("page"))
rsc.PageSize=3
pageCount = cint(rsc.pageCount)
if page = 0 then
page =1
end if
rsc.AbsolutePage = page
x=1
WHILE NOT rsc.EOF AND NumRows<rsc.PageSize
%>
<tr><td width="757" height="31" valign="top" bgcolor="#B4C7D8"><div align="left"><span class="STYLE2"><%=rsc("title")%> </span></div></td>
</tr>
<%
rsc.MoveNext
NumRows=NumRows+1
WEND
%>
<tr><td width="105%" align="center" colspan="6">
<p align="center"><FONT color=#333333>共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=1"> 首页</A>
<%end if%>★
<%if page>1 then%><A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=page-1%>"><%end if%>上一页</a>
<%
dim pagewhere
dim p
p = 1
'把pagewhere转换成整数
'pagewhere = cint(request("pagewhere"))
pagewhere = pageCount
if pagewhere>0 then
for p=1 to pagewhere
if p <> page then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=p%>"><%=p%></a>
<%end if
if p =page then%>
<%=p%>
<% end if
next
end if%>
<%if page < PageCount then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=page+1%>">
<%end if %>下一页</A>★
<%if page=PageCount then%>尾页
<%end if%>
<%if page<PageCount then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=PageCount%>"> 尾页</A>
<%end if%>
</FONT></p></td></tr>
<tr>
<td height="17" valign="top" bgcolor="#999999"><div align="center" class="STYLE2"><a href="index.asp" class="STYLE2">返回首页</a></div></td>
</tr>
<tr>
<td height="16"> </td>
</tr>
</table>
</div>
</body>
</html>
<%
rs.close
rsc.close
set rs=nothing
set rsc=nothing
conn.close
set conn=nothing
%>
最好具体告诉我怎么改吧,我实在不知道怎么改才好了 展开
<%
set rs=server.createobject("adodb.recordset")
sql="select * from class where id="&request.querystring("id")
rs.open sql,conn,1,1
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title><%=rs("class")%>-软件</title>
<style type="text/css">
<!--
.STYLE2 {font-size: 12pt}
a:link { font-size: 9pt; text-decoration: none; color: blue; }
a:visited { font-size: 12pt; text-decoration: none; color: Purple; }
body {
background-color: #94C4C5;
}
-->
</style>
</head>
<body>
<div align="center">
<table width="768" border="0">
<!--DWLayoutTable-->
<tr>
<td height="14" colspan="3" valign="top" bgcolor="#6F79C4"><div align="center" class="STYLE2"><a href="index.asp" class="STYLE2"></a><%=rs("class")%></div></td>
</table>
<table width="763" border="0">
<!--DWLayoutTable-->
<%
set rsc=server.createobject("adodb.recordset")
sqlc="select * from introduce where class='"&rs("class")&"' order by id desc"
rsc.open sqlc,conn,1,1
dim pageCount
page = cint(request("page"))
rsc.PageSize=3
pageCount = cint(rsc.pageCount)
if page = 0 then
page =1
end if
rsc.AbsolutePage = page
x=1
WHILE NOT rsc.EOF AND NumRows<rsc.PageSize
%>
<tr><td width="757" height="31" valign="top" bgcolor="#B4C7D8"><div align="left"><span class="STYLE2"><%=rsc("title")%> </span></div></td>
</tr>
<%
rsc.MoveNext
NumRows=NumRows+1
WEND
%>
<tr><td width="105%" align="center" colspan="6">
<p align="center"><FONT color=#333333>共<%=PageCount%>页 第<%=page%>页★
<%if page=1 then%>首页<%end if%>
<%if page>1 then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=1"> 首页</A>
<%end if%>★
<%if page>1 then%><A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=page-1%>"><%end if%>上一页</a>
<%
dim pagewhere
dim p
p = 1
'把pagewhere转换成整数
'pagewhere = cint(request("pagewhere"))
pagewhere = pageCount
if pagewhere>0 then
for p=1 to pagewhere
if p <> page then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=p%>"><%=p%></a>
<%end if
if p =page then%>
<%=p%>
<% end if
next
end if%>
<%if page < PageCount then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=page+1%>">
<%end if %>下一页</A>★
<%if page=PageCount then%>尾页
<%end if%>
<%if page<PageCount then%>
<A HREF="class.asp?id=<%=rs("id")%>&class=<%=rsc("class")%>&page=<%=PageCount%>"> 尾页</A>
<%end if%>
</FONT></p></td></tr>
<tr>
<td height="17" valign="top" bgcolor="#999999"><div align="center" class="STYLE2"><a href="index.asp" class="STYLE2">返回首页</a></div></td>
</tr>
<tr>
<td height="16"> </td>
</tr>
</table>
</div>
</body>
</html>
<%
rs.close
rsc.close
set rs=nothing
set rsc=nothing
conn.close
set conn=nothing
%>
最好具体告诉我怎么改吧,我实在不知道怎么改才好了 展开
5个回答
展开全部
出现这种问题,一般都是读取的时候,没有值存在,仍进行读取。
检查
每次从数据库读出数据后,进行if判断。
另检查分页的时候,是否没做判断
-----------------------------------
你先把分页导航那一块去掉,问题最可能出现在那。
因为你之前的while循环,判断是当为eof时跳出循环,而你下边导航却又引用了rec("class"),已经是eof了,再引用当然会找不到值了。
其次就是在查询后,加上
if rs.eof then
输出:无信息可查询
end if
检查
每次从数据库读出数据后,进行if判断。
另检查分页的时候,是否没做判断
-----------------------------------
你先把分页导航那一块去掉,问题最可能出现在那。
因为你之前的while循环,判断是当为eof时跳出循环,而你下边导航却又引用了rec("class"),已经是eof了,再引用当然会找不到值了。
其次就是在查询后,加上
if rs.eof then
输出:无信息可查询
end if
展开全部
if
rs.eof
then
'这里判断一个就够了
response.write"<SCRIPT
language=JavaScript>alert('对不起,没有符合搜索条件的记录!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end()'加上这句,后面的语句就不会执行了,并且也不会出错
end
if
rs.pagesize=10
if
pagecount>rs.pagecount
or
pagecount<=0
then
pagecount=1
end
if
rs.AbsolutePage=pagecount
%>
rs.eof
then
'这里判断一个就够了
response.write"<SCRIPT
language=JavaScript>alert('对不起,没有符合搜索条件的记录!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end()'加上这句,后面的语句就不会执行了,并且也不会出错
end
if
rs.pagesize=10
if
pagecount>rs.pagecount
or
pagecount<=0
then
pagecount=1
end
if
rs.AbsolutePage=pagecount
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你这个语句本来就不对
if
rs.eof
and
rs.bof
then
我实在看不明白
一个是在末尾一个是头部。。。
怎么可以两个条件同时存在呢?
if
rs.eof=false
and
rs.bof=false
then
试一下这个语句。。它
的意思是当两个条件都不成立时执行。。否则不执行
if
rs.eof
and
rs.bof
then
我实在看不明白
一个是在末尾一个是头部。。。
怎么可以两个条件同时存在呢?
if
rs.eof=false
and
rs.bof=false
then
试一下这个语句。。它
的意思是当两个条件都不成立时执行。。否则不执行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
if
rs.eof
and
rs.bof
then
response.write"<SCRIPT
language=JavaScript>alert('对不起,没有符合搜索条件的记录!');"
response.write"javascript:history.go(-1)</SCRIPT>"
在这行后边加response.end
end
if
rs.eof
and
rs.bof
then
response.write"<SCRIPT
language=JavaScript>alert('对不起,没有符合搜索条件的记录!');"
response.write"javascript:history.go(-1)</SCRIPT>"
在这行后边加response.end
end
if
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
第
101
行是这句吗?
if
rs.eof
and
rs.bof
then
这样就可以了,不需要bof
if
rs.eof
then
101
行是这句吗?
if
rs.eof
and
rs.bof
then
这样就可以了,不需要bof
if
rs.eof
then
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询