| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 799 人关注过本帖
标题:帮忙看看那里错了!先谢过了
只看楼主 加入收藏
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
结帖率:0
收藏
 问题点数:0 回复次数:11 
帮忙看看那里错了!先谢过了

<%
dim t,j,i,k
set rs1=server.createobject("ADODB.Recordset")
sql1="select * from p_news where agree=1 and check=1 order by id desc"

rs1.open sql1,conn,1,1
if rs1.eof or rs1.bof then
%>
<tr>
<td width="159"><font color="#454545"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> 暂时没有任何纪录</font></td>
</tr>
<%
else
set rs2=server.createobject("ADODB.Recordset")
sql2="select * from p_news where agree=1 and top=1 and check=1 order by id desc"
rs2.open sql2,conn,1,1
if rs2.eof or rs2.bof then
t=1
do while not rs1.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if rs1.eof then
exit do
end if
rs1.movenext
t=t+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if t>=20 then
exit do
end if

if rs1.eof then
exit do
end if
rs1.movenext
t=t+1
loop


else
j=1
do while not rs2.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs2("id")%>"><font color="#454545"><%=left(rs2("title"),12)%></font></a></td>
<%
if rs2.eof then
exit do
end if
rs2.movenext
j=j+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs2("id")%>"><font color="#454545"><%=left(rs2("title"),12)%></font></a></td>
</tr>
<%
if rs2.eof then
exit do
end if

if j>=20 then
exit do
end if
rs2.movenext
j=j+1
loop

if j < 20 then
i= (20-j)
if i=1 then
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
elseif i mod 2=0 then
k=1
do while not rs1.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if k>=i then
exit do
end if

if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
loop
elseif i mod 2=1 and i<>1 then
k=1
do while not rs1.eof
%>

<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if k>=i-1 then
exit do
end if
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
loop
rs1.movenext
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%

else
response.Write "系统出错!请尽快处理"
end if
end if
end if
rs2.close
set rs2=nothing
end if

rs1.close
set rs1=nothing
%>

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

搜索更多相关主题的帖子: 159 border color where 
2007-03-25 10:25
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
收藏
得分:0 

难到星期日没人吗?郁闷!


2007-03-25 11:29
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
收藏
得分:0 
没人啊,我真可怜

2007-03-25 15:04
做人很低调
Rank: 5Rank: 5
等 级:贵宾
威 望:18
帖 子:1268
专家分:0
注 册:2006-8-2
收藏
得分:0 
报错信息中有没有说哪一行错了?

其实我很低调,只是你不知道...
2007-03-25 17:35
hai20041004
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2007-3-14
收藏
得分:0 

看看是哪一行,应该是数据的问题……

2007-03-25 17:42
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
收藏
得分:0 
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。

2007-03-26 09:02
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
以下是引用dh2007在2007-3-25 10:25:33的发言:

<%
dim t,j,i,k
set rs1=server.createobject("ADODB.Recordset")
sql1="select * from p_news where agree=1 and check=1 order by id desc"

rs1.open sql1,conn,1,1
if rs1.eof or rs1.bof then
%>
<tr>
<td width="159"><font color="#454545"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> 暂时没有任何纪录</font></td>
</tr>
<%
else
set rs2=server.createobject("ADODB.Recordset")
sql2="select * from p_news where agree=1 and top=1 and check=1 order by id desc"
rs2.open sql2,conn,1,1
if rs2.eof or rs2.bof then '都已经为空了,还怎么??????
t=1
do while not rs1.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if rs1.eof then
exit do
end if
rs1.movenext
t=t+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if t>=20 then
exit do
end if

if rs1.eof then
exit do
end if
rs1.movenext
t=t+1
loop


else
j=1
do while not rs2.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs2("id")%>"><font color="#454545"><%=left(rs2("title"),12)%></font></a></td>
<%
if rs2.eof then
exit do
end if
rs2.movenext
j=j+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs2("id")%>"><font color="#454545"><%=left(rs2("title"),12)%></font></a></td>
</tr>
<%
if rs2.eof then
exit do
end if

if j>=20 then
exit do
end if
rs2.movenext
j=j+1
loop

if j < 20 then
i= (20-j)
if i=1 then
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
elseif i mod 2=0 then
k=1
do while not rs1.eof
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if k>=i then
exit do
end if

if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
loop
elseif i mod 2=1 and i<>1 then
k=1
do while not rs1.eof
%>

<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
%>
<tr>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
<%
if k>=i-1 then
exit do
end if
if rs1.eof then
exit do
end if
rs1.movenext
k=k+1
loop
rs1.movenext
%>
<td width="159"><img border="0" src="IMAGE/A17.gif" width="9" height="8"> <a href="news.asp?id=<%=rs1("id")%>"><font color="#454545"><%=left(rs1("title"),12)%></font></a></td>
</tr>
<%

else
response.Write "系统出错!请尽快处理"
end if
end if
end if
rs2.close
set rs2=nothing
end if

rs1.close
set rs1=nothing
%>

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


http://www./
2007-03-26 09:14
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
收藏
得分:0 
if rs2.eof or rs2.bof then '都已经为空了,还怎么??????
意思如果是通过审核和有推荐的不为空,就查询通过审核既有推荐又有置顶属性的新闻,如果查询结果为空,就显示
通过审核和有推荐的新闻
所以
if rs2.eof or rs2.bof then 为空了还要执行

2007-03-26 09:26
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

不过楼主这个程序有些逻辑混乱的说。

2007-03-26 09:37
dh2007
Rank: 1
等 级:新手上路
帖 子:228
专家分:0
注 册:2007-2-28
收藏
得分:0 
我知道了,哈哈哈哈哈

2007-03-26 10:08
快速回复:帮忙看看那里错了!先谢过了
数据加载中...
 
   



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

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