| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 395 人关注过本帖
标题:[求助]为什么会出现这样的错误呢?
只看楼主 加入收藏
jingjinghr
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-3-26
收藏
 问题点数:0 回复次数:4 
[求助]为什么会出现这样的错误呢?

<!--#include file=conn.asp-->
<%
selectd=request("select")
text=request("text")
if text="" then
response.Write("<script language=javascript>alert('最少输入一个条件');location='javascript:history.go(-1)'</script>")
else
select case selectd
case "标题"
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from tb_BBS where title like'%"&text&"%'order by id desc"
rs2.open sql2,conn,1,1

case "作者"

set rs2=server.CreateObject("adodb.recordset")
sql2="select * from tb_BBS where author like '%"&text&"%' order by id desc"
rs2.open sql2,conn,1,1

end select
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>论坛搜索</title>
<style type="text/css">
<!--
a:link{color:#000000;text-decoration:none} a:visited{color:#000000;text-decoration:none} a:hover{color:red;text-decoration:underline}
.STYLE1 {font-size: 12px}
.STYLE2 {
font-family: "宋体";
font-weight: bold;
color: #FFFFFF;
}
.style13 {font-size: 12px}
-->
</style>
</head>

<body background="images/kabg.gif" topmargin="0">
<table width="760" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF99CC">
<tr>
<td width="31" height="23" align="center" background="images/g3.gif">&nbsp;</td>
<td width="528" align="center" background="images/g3.gif"><span class="STYLE2">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题</span></td>
<td width="120" align="center" background="images/g3.gif"><span class="STYLE2">作者</span></td>
<td width="75" align="center" background="images/g3.gif"><span class="STYLE2">回复</span></td>
</tr>
<tr>
<td colspan="4">
<%
shum=30
if not rs2.eof then
tel=rs2.recordcount
rs2.pagesize=shum
maxpage=rs2.pagecount
requestpage=clng(request("p"))
if requestpage="" or requestpage=0 then
requestpage=1
end if
if requestpage>maxpage then
requestpage=maxpage
end if
if not requestpage=1 then
rs2.move (requestpage-1)*rs2.pagesize
end if
for i=1 to rs2.pagesize and not rs2.eof
%>
<table width="760" height="24" border="0">
<tr valign="top">
<td width="27" height="20" align="center" valign="middle" bgcolor="#FFCCFF"><img src="images/lock_folder.gif" width="16" height="16"></td>
<td width="527" valign="middle" bgcolor="#FFCCCC"><span class="style1"><a href="luntan2.asp?Num=<%=rs2("Num")%>&No=<%=Request("No")%>"><%=rs2("title")%></a>
</span></td>
<td width="117" align="center" valign="middle" bgcolor="#CCCCFF"><span class="style1"><font color="#800000">
<%=rs2("author")%></font></span></td>
<td width="71" align="center" valign="middle" bgcolor="#FFCCCC"><span class="style1"><font color="#800000">
<%=rs2("backcount")%></font></span></td>
</tr>
</table><%
rs2.MoveNext
if rs2.eof then exit for
next
else
response.Write("没有找到相关的发言!")
end if
%>
</td>
</tr>
</table>
<table width="760" border="0" align="center">
<tr>
<td align="right"><span class="style1">共<%= maxpage %>页 当前页:<%= requestpage %>
<a href="search.asp?p=<%=requestpage-1%>&select=<%=selectd%>&text=<%=text%>">上一页</a>
<a href="search.asp?p=<%=requestpage+1%>&select=<%=selectd%>&text=<%=text%>">下一页</a></span></td>
</tr>
</table>
</body>
</html>
<%end if%>

错误提示:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

哪个热心人能认真看看,帮帮我啊 当查找信息为空的时候,不会提示没有找到信息,就是出错。
先在这里谢谢了

[此贴子已经被作者于2007-5-25 20:09:22编辑过]

搜索更多相关主题的帖子: javascript request include title where 
2007-05-25 19:22
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
rs2.move (requestpage-1)*rs2.pagesize个人认为rs有自己的分页算法不需要自己写算法。
楼主可以试试吧rs2.move改成rs2.AbsolutePage=requestpage这样试试。
2007-05-25 20:28
jingjinghr
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-3-26
收藏
得分:0 

还是不行啊???还是那样的错误?
大家在看看咯 谢谢啦

2007-05-27 23:11
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
收藏
得分:0 
<%
rs2.MoveNext
if rs2.eof then exit for
next
else
response.Write("没有找到相关的发言!")
end if
%>

改成
<%
rs2.MoveNext
'if rs2.eof then exit for
next
else
response.Write("没有找到相关的发言!")
end if
%>
试试
2007-05-28 13:14
jingjinghr
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2006-3-26
收藏
得分:0 

先谢谢各位了
还是不行啊!!!! 同样的代码
这段就能提示没有相关的发言
<!--#include file=conn.asp-->

<%
text=request("text")
if text="" then
response.Write("<script language=javascript>alert('请输入要查找的关键字!');location='javascript:history.go(-1)'</script>")
else

set rs2=server.CreateObject("adodb.recordset")
sql2="select * from tb_News where title like'%"&text&"%'order by id desc"
rs2.open sql2,conn,1,1
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>站内搜索</title>
<style type="text/css">
<!--
a:link{color:#000000;text-decoration:none} a:visited{color:#000000;text-decoration:none} a:hover{color:red;text-decoration:underline}
.STYLE1 {font-size: 12px}
.STYLE2 {
font-family: "宋体";
font-weight: bold;
color: #FFFFFF;
}
.style13 {font-size: 12px}
-->
</style>
</head>

<body background="images/kabg.gif" topmargin="0">
<table width="760" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FF99CC">
<tr>
<td width="528" height="23" background="images/g3.gif"><span class="STYLE2 style13">以下是您所查找的内容:</span></td>
</tr>
<tr>
<td>
<%
shum=30
if not rs2.eof then
tel=rs2.recordcount
rs2.pagesize=shum
maxpage=rs2.pagecount
requestpage=clng(request("p"))
if requestpage="" or requestpage=0 then
requestpage=1
end if
if requestpage>maxpage then
requestpage=maxpage
end if
if not requestpage=1 then
rs2.move (requestpage-1)*rs2.pagesize
end if
for i=1 to rs2.pagesize and not rs2.eof
%>
<table width="760" height="24" border="0">
<tr valign="top">
<td width="30" height="20" align="center" valign="middle" bgcolor="#FFCCFF"><img src="images/20070119201723299.gif" width="16" height="16" align="absmiddle"></td>
<td width="484" valign="middle" bgcolor="#FFCCCC"><span class="style1"><a href="javascript:" onClick="window.open('open.asp?id=<%=rs2("id")%>','','width=500,height=550,scrollbars=yes')"><%=rs2("title")%></a>
</span></td>
<td width="136" align="center" valign="middle" bgcolor="#CCCCFF"><span class="style1"><font color="#800000">
[<%=rs2("IssueDate")%>]</font></span></td>

<td width="92" align="center" valign="middle" bgcolor="#FFCCFF"><span class="style1"><%=rs2("type")%></span></td>
</tr>
</table>
<%
Rs2.MoveNext
if rs2.eof then exit for
next
Rs2.Close
Set Rs2=Nothing
else
response.Write("没有相关的资料信息!!")
end if
%>
</td>
</tr>
</table>
<table width="760" border="0" align="center">
<tr>
<td align="right"><span class="style1">共<%= maxpage %>页 当前页:<%= requestpage %>
<a href="search0.asp?p=<%=requestpage-1%>&text=<%=text%>">上一页</a>
<a href="search0.asp?p=<%=requestpage+1%>&text=<%=text%>">下一页</a></span></td>
</tr>
</table>
</body>
</html>
<%end if%>

到底是怎么回事呢?

2007-05-28 13:25
快速回复:[求助]为什么会出现这样的错误呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012758 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved