| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 969 人关注过本帖
标题:ADODB.Field (0x80020009)这是怎么一回事
只看楼主 加入收藏
kombel
Rank: 2
等 级:论坛游民
帖 子:69
专家分:48
注 册:2011-6-15
结帖率:92.31%
收藏
已结贴  问题点数:20 回复次数:11 
ADODB.Field (0x80020009)这是怎么一回事
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/admin/finlist.asp
程序代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../Connections/conn.asp" -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.>
<html xmlns="http://www.>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {    font-size: 36px;
    font-weight: bold;
}
-->
</style>
</head>

<body>
<table width="600" border="0" cellpadding="5" cellspacing="0" bordercolor="#E8E09F" align="center" >
  <tr>
    <td colspan="3" align="center" nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7"><span class="STYLE1">详单</span></td>
  </tr>
  <tr>
    <%cx = request("id")
sql = "select * from pay where author like '%"&cx& "%' order by id desc"
set rs=server.createobject("adodb.recordset")'
  rs.open sql,conn,1,1

 %>
    <%if rs.bof then
response.write "<td align='center'><strong>对不起!没有相关的记录</strong></td>"
response.end
end if
%>
    <td colspan="1" nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 " align="left"><strong>客户名称:<%=rs("user")%></strong></td>
    <td nowrap="nowrap" bgcolor="#F3EFCD" colspan="1" class="STYLE7 "  align="center"><strong> 电话:</strong></td>
    <td nowrap="nowrap" bgcolor="#F3EFCD" colspan="1" class="STYLE7 " align="right"><strong>NO. <%=rs("no")%></strong></td>
  </tr>
</table>
<table width="600" border="1" cellpadding="5" cellspacing="0" bordercolor="#E8E09F"  id="detailItem" align="center" >
  <tr>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 td1" align="center"><strong>商品名称</strong></td>
    <td   nowrap="nowrap" bgcolor="#F3EFCD" class="td1 STYLE7" align="center"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 td1" align="center"><strong>单位</strong></td>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 td1" align="center"><strong>数量</strong></td>
    <td   nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 td1" align="center"><strong>单价</strong></td>
    <td   nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 td1" align="center"><strong>金额</strong></td>
  </tr>
  <%
sum1=0    '总金额初始值=0
 WHILE NOT RS.EOF
%>
  <tr >
    <td   nowrap="nowrap" bgcolor="#F3EFCD"  align="center"><%=rs("name")%></td>
    <td   nowrap="nowrap" bgcolor="#F3EFCD" align="center"><%=rs("size")%></td>
    <td   nowrap="nowrap" bgcolor="#F3EFCD" align="center"><%unit=rs("unit")
                                                        response.write(unit)%></td>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" align="center"><%quantity=rs("quantity")
                                                   response.write(quantity)%></td>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" align="center"><%pric=rs("pric")
                                                 sum=pric*quantity
                                                   sum1=sum1+sum
                                                   response.write(pric)
                                                   %></td>
    <td nowrap="nowrap" bgcolor="#F3EFCD" align="center"><% response.write(sum)%></td>
  </tr>
  <%RS.MoveNext
WEND%>
</table>
<table width="600" border="1" cellpadding="5" cellspacing="0" bordercolor="#E8E09F"  id="detailItem" align="center" >
  <tr>
    <%    
  dim   a   '要转换成大写的金额    
  dim   atoc   '转换之后的值    
  Dim   String1   '如下定义    
  Dim   String2   '如下定义    
  Dim   String3   '从原A值中取出的值    
  Dim   I   '循环变量    
  Dim   J   'A的值乘以100的字符串长度    
  Dim   Ch1   '数字的汉语读法    
  Dim   Ch2   '数字位的汉字读法    
  Dim   nZero   '用来计算连续的零值是几个
    
  a=sum1
  String1   =   "零壹贰叁肆伍陆柒捌玖"    
  String2   =   "万仟佰拾亿仟佰拾万仟佰拾元角分"    
  nZero   =   0    
   
  If   InStr(1,   CStr(a   *   100),   ".")   <>   0   Then    
  err.Raise   5000,   ,   "此函数(   AtoC()   )只能转换小数点后有两位以内的数!"    
  End   If    
   
  J   =   Len(CStr(a   *   100))    
  String2   =   Right(String2,   J)   '取出对应位数的STRING2的值    
   
  For   I   =   1   To   J    
  String3   =   Mid(a   *   100,   I,   1)   '取出需转换的某一位的值    
   
  If I <>(J - 3) + 1 And I <> (J  - 7) + 1And I <>  (J - 11) + 1  And I  <>(J  -   15)   +   1   Then    
  If   String3   =   0   Then    
  Ch1   =   ""    
  Ch2   =   ""    
  nZero   =   nZero   +   1    
  ElseIf   String3   <>   0   And   nZero   <>   0   Then    
  Ch1   =   ""   &   Mid(String1,   clng(String3)   +   1,   1)    
  Ch2   =   Mid(String2,   I,   1)    
  nZero   =   0    
  Else    
  Ch1   =   Mid(String1,   clng(String3)   +   1,   1)    
  Ch2   =   Mid(String2,   I,   1)    
  nZero   =   0    
  End   If    
  Else   '该位是万亿,亿,万,元位等关键位    
  If   String3   <>   0   And   nZero   <>   0   Then    
  Ch1   =   ""   &   Mid(String1,   clng(String3)   +   1,   1)    
  Ch2   =   Mid(String2,   I,   1)    
  nZero   =   0    
  ElseIf   String3   <>   0   And   nZero   =   0   Then    
  Ch1   =   Mid(String1,   clng(String3)   +   1,   1)    
  Ch2   =   Mid(String2,   I,   1)    
  nZero   =   0    
  ElseIf   String3   =   0   And   nZero   >=   3   Then    
  Ch1   =   ""    
  Ch2   =   ""    
  nZero   =   nZero   +   1    
  Else    
  Ch1   =   ""    
  Ch2   =   Mid(String2,   I,   1)    
  nZero   =   nZero   +   1    
  End   If    
   
  If   I=(J -11)+1Or   I   =   (J   -   3)   +   1   Then   '如果该位是亿位或元位,则必须写上    
  Ch2   =   Mid(String2,   I,   1)    
  End   If    
   
  End   If    
  AtoC   =   AtoC   &   Ch1   &   Ch2    
   
  If   I   =   J   And   String3   =   0   Then   '最后一位(分)为0时,加上“整”    
  AtoC   =   AtoC   &   ""    
  End   If    
   
  Next    
  if   a=0   then    
  atoc="零元整"    
  end   if
   %>
    <td width="90" align="center" nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 "><strong>合计大写:</strong></td>
    <td width="360" align="center" nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 "><%=atoc%>&nbsp;</td>
    <td width="120" align="left" nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7 "><span class="admintitle"><strong></strong></span>:<%=sum1%></td>
  </tr>
</table>
<table width="600" border="0" cellpadding="5" cellspacing="0" bordercolor="#E8E09F"  id="detailItem" align="center" >
  <tr>
    <td  nowrap="nowrap" bgcolor="#F3EFCD" class="STYLE7"><strong>制单人:
          <%response.write(rs("jidan"))%>
    </strong></td>
  </tr>
</table>
</body>
</html>



搜索更多相关主题的帖子: 记录 admin color 
2011-08-04 10:40
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:10 
记录集为空,没有查询到这个id的记录

----我怎能在别人的苦难面前转过脸去----
2011-08-04 10:47
kombel
Rank: 2
等 级:论坛游民
帖 子:69
专家分:48
注 册:2011-6-15
收藏
得分:0 
回复 2楼 dzt0001
有的啊    没有怎么没有显示  我有加判断的啊
2011-08-04 10:51
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
错误行是哪行?

----我怎能在别人的苦难面前转过脸去----
2011-08-04 10:54
kombel
Rank: 2
等 级:论坛游民
帖 子:69
专家分:48
注 册:2011-6-15
收藏
得分:0 
回复 4楼 dzt0001
错误提示就是这些:
错误类型:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。
/admin/finlist.asp
2011-08-04 11:06
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
需要看一下表的结构和数据

[ 本帖最后由 dzt0001 于 2011-8-4 12:34 编辑 ]

----我怎能在别人的苦难面前转过脸去----
2011-08-04 11:12
kombel
Rank: 2
等 级:论坛游民
帖 子:69
专家分:48
注 册:2011-6-15
收藏
得分:0 
回复 6楼 dzt0001
图片附件: 游客没有浏览图片的权限,请 登录注册
2011-08-04 11:22
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
没看到有jidan这个字段,估计是截图没截下来。
假设有这个字段,在你显示“制单人”前,所有记录已经遍历完成,此时已经是rs.eof(记录集指针在最后一条记录之后),所以没办法读取rs("jidan")

----我怎能在别人的苦难面前转过脸去----
2011-08-04 12:43
kombel
Rank: 2
等 级:论坛游民
帖 子:69
专家分:48
注 册:2011-6-15
收藏
得分:0 
回复 8楼 dzt0001
那怎么解决这个问题呢
2011-08-04 13:46
噶么噶么
Rank: 2
等 级:论坛游民
帖 子:15
专家分:67
注 册:2011-8-3
收藏
得分:10 
学习
可以在遍历前给变量赋值
假如有
 jidan=rs("jidan")

最后用response.write(jidan)输出

[ 本帖最后由 噶么噶么 于 2011-8-4 14:01 编辑 ]
2011-08-04 13:48
快速回复:ADODB.Field (0x80020009)这是怎么一回事
数据加载中...
 
   



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

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