标题:BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除
只看楼主
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
结帖率:100%
 问题点数:0 回复次数:3 
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除
<%@LANGUAGE="VBScript" CODEPAGE="936"%>
<!-- #include file="conn.asp" -->


 <body bgcolor=#0099CC>
   <% name=request("name") %>

   <% Set rss=server.CreateObject("adodb.recordset")
            sql1="select * from kb where name='"&name&"' order by xnd desc"
                rss.open sql1,conn,1,1 %>




  <title><% =rss("name") %>的课表</title>
 
<table align=center>
<tr><td  align=center height=15></td></tr>
<tr><td align=center><font color=#fafa00 size=5><b><%=rss("schoolname")%></b></font></td></tr>
<tr><td align=center height=10><font color=#f0f0aa size=3><b>任课教师:<% =rss("name") %></b></td></tr>

<% count=0
   do while not rss.eof and count<rss.recordcount %>
<tr>
<%if count Mod 2=0 then%><Td bgcolor="#C9E3FA" onMouseOver="this.style.backgroundColor='#FFE8E8'" onMouseOut="this.style.backgroundColor='#C9E3FA'">
     <%else%><Td bgcolor="#E2EEFC" onMouseOver="this.style.backgroundColor='#FFE8E8'" onMouseOut="this.style.backgroundColor='#E2EEFC'">
<%end if%>

<table border=1 align=center cellpadding=2 cellspacing=1>
<tr><td botton>表<% =count+1 %></td></tr>
<tr><td colspan=8 align=center><% =rss("xnd") %>学年度<% =rss("xq") %>学期课表</td></tr>
<tr><td align=center width=9%>节次</td>
<% For i=1 To 7
    Dim rmb
        rmbs(i)  %>
<td align=center width=13%>星期<% =rmb %></td>
<% Next %>
<% For i=1 To 4 %>
<tr>     
<td align=center><% =i %></td>
<% For j=1 To 7 %>
  <%   wa=rss("w"&CStr(j)&CStr(i))  
  if wa="" Or wa=" " then wa=" " end if %>
<td align=center><% =wa %></td>
<% Next %>
</tr>
<% Next %>
<tr><td colspan=8 align=center>午 间 休 息</td></tr>
<% For i=5 To 7 %>
<tr>
<td align=center><% =i%></td>
<% For j=1 To 7 %>
<td align=center>
<% wa=rss("w"&CStr(j)&CStr(i))
   If wa="" Or wa=" " Then wa=" " End If %>
    <% =wa %>
</td>
<% Next %>
</tr>
<% Next %>
</table>
</td></tr>
<tr><td  align=center>

<input type="button" name="Submit4" value="添加" onClick="subadd()" style="width:85;background-color: #FFCC66; color: #000000; border: 1 solid #00CC00">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="Submit1" value="修改" onClick="subedit()" style="width:85;background-color: #FFCC66; color: #000000; border: 1 solid #00CC00">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="Submit2" value="删除" onClick="subdel()" style="width:85;background-color: #FFCC66; color: #000000; border: 1 solid #00CC00">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" name="Submit3" value="输出" onClick="subtoxls()" style="width:85;background-color: #FFCC66; color: #000000; border: 1 solid #00CC00">

</td><tr>

<tr><td height=25></td></tr>
<% count=count+1
   rss.movenext
   Loop %>
</table>



</body>
<%
Function rmbs(num)
num = FormatNumber(num, 2)
Dim numList
Dim rmbList
Dim numLen
Dim numChar
Dim numstr
Dim n
Dim n1, n2
Dim hz
numList = "0一二三四五六日八九十"
rmbList = "分角元拾佰仟万拾佰仟亿拾佰仟万"
If num > 9999999999999.99 Then
    rmb = "超出范围的人民币值"
    Exit Function
End If
numstr = CStr(num * 100)
numLen = Len(numstr)
n = 1
Do While n <= numLen
    numChar = CInt(Mid(numstr, n, 1))
    n1 = Mid(numList, numChar + 1, 1)
    n2 = Mid(rmbList, numLen - n + 1, 1)
    If Not n1 = "jj零" Then
        hz = hz + CStr(n1) + CStr(n2)
    Else
        If n2 = "亿" Or n2 = "万" Or n2 = "元" Or n1 = "零" Then
          Do While Right(hz, 1) = "零"
            hz = Left(hz, Len(hz) - 1)
            Loop
        End If
        If (n2 = "亿" Or (n2 = "万" And Right(hz, 1) <> "亿") Or n2 = "元") Then
            hz = hz + CStr(n2)
        Else
            If Left(Right(hz, 2), 1) = "零" Or Right(hz, 1) <> "亿" Then
             hz = hz + n1
            End If
        End If
    End If
    n = n + 1
Loop
Do While Right(hz, 1) = "零"
    hz = Left(hz, Len(hz) - 1)
Loop
If Right(hz, 1) = "元" Then
    hz = hz + "整"
End If
rmb = left(hz,1)
End Function
%>


<script language=javascript>
function subedit()
{
window.location.href="kb_edit.asp?id=<%=rss("编号")%>";
}
//
function subadd()
{
window.location.href="kb_add.asp?name=<%=name%>";
}
//
function subdel()
{
window.location.href="kb_del.asp?id=<%=rss("编号")%>";
}
//
function subtoxls()
{
window.location.href="kb_toxls.asp?id=<%=rss("编号")%>";
}
</script>


请注意红色部分函数代码,如果删除则一切正常,有这段代码就出现了错误信息:

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

这就是我找了许多的解决方案也解决不了,因为问题并不出在rss.eof和rss.bof上


其中,只有kb_add()函数可用,其它函数加上就出错,请高手找出原因来
搜索更多相关主题的帖子: BOF EOF Field ADODB 记录 
2008-06-23 18:34
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
得分:0 
由上一个函数传递过来的参数就是name
其它的只能在数据库中读取
2008-06-23 18:36
jxzhu
Rank: 1
等 级:新手上路
帖 子:63
专家分:0
注 册:2008-6-11
得分:0 
解决办法是在函数前加上一行:
id=rss("编号")

之后引用是:
id=<%=id%>
就不出错了
2008-06-23 19:40
anlige
Rank: 3Rank: 3
等 级:新手上路
威 望:7
帖 子:401
专家分:0
注 册:2006-11-3
得分:0 
显示前用
if rss.eof and rss.bof then
来判断下数据记录是不是空

http://www.
zhanghuiguoanlige@
2008-06-24 01:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-220750-1-1.html




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

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