我的代码闹鬼了..帮忙看下!

fs2006 2006-04-20 05:47:17
<!--#include file="conn.asp" -->
<% set rs=server.createobject("adodb.recordset")
sql="select * from Chu_ku where spdingdan1='"&request("id")&"'"
rs.open sql,conn,1,1
response.write rs.recordcount
%>
<%
Function daxie(smoney)
Dim x, y
Const zimu = ".sbqwsbqysbqwsbq" '定义位置代码
Const letter = "0123456789sbqwy.zjf" '定义汉字缩写
Const upcase = "零壹贰叁肆伍陆柒捌玖拾佰仟萬億元整角分" '定义大写汉字
Dim temp
Dim i
smoney=Replace(FormatNumber(smoney,2),",","")
temp = Left(temp, InStr(smoney, ".") - 1)
x=smoney
y = ""
For i = 1 To Len(x)-3
y = y & Mid(x, i, 1) & Mid(zimu, Len(x) - 2 - i, 1)
Next
If Right(x, 3) = ".00" Then
y = y & "z"
Else
y = y & Left(Right(x, 2), 1) & "j" & Right(x, 1) & "f"
End If
y = Replace(y, "0q", "0")
y = Replace(y, "0b", "0")
Do While y <> Replace(y, "00", "0")
y = Replace(y, "00", "0")
Loop
y = Replace(y, "0y", "y")
y = Replace(y, "0w", "w")
If Len(x) = 5 And Left(y, 1) = "1" then y=Right(y, Len (y)- 1)
If Len(x) = 4 then
y=Replace(y, "0.", "")
else
y=Replace(y, "0.", ".")
end if
For i = 1 To 19
y = Replace(y, Mid(letter, i, 1), Mid(upcase, i, 1))
Next
daxie = y
End Function
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>无标题文档</title>
<style type="text/css">
<!--
.style1 {font-size: x-large}
body,td,th {
font-size: 13px;
}
-->
</style>
</head>

<body>
<table width="90%" border="0" align="left">
<tr>
<td align="center"><span class="style1"><font size="90" face="楷体_GB2312">出库单</font></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="100%" border="0" align="center">
<tr>
<td width="47%">摘要:</td>
<td width="53%" align="right">公司内部出库单号码:      <%=rs("spdingdan1")%> </td>
</tr>
<tr>
<td>购买单位:<%=rs("spout")%></td>
<td align="right">商场订单号:      <%=rs("spchuku2")%> </td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="573" height="79" border="1" align="center" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td width="165" height="29" align="center">商品全名</td>
<td width="81" align="center">规格</td>
<td width="81" align="center">单位</td>
<td width="81" align="center">数量</td>
<td width="81" align="center">单价</td>
<td width="81" align="center">金额</td>
</tr>
<% do while not rs.eof
%>
<tr bgcolor="#FFFFFF">
<td height="16" align="center"><%=rs("spname1")%></td>
<td align="center"><%=rs("spguige")%></td>
<td align="center"><%=rs("spdanwei")%></td>
<td align="center"><%=rs("spshuliang1")%><%=rs("spzhuang1")%></td>
<td align="center"><%=rs("spdanjia1")%></td>
<td align="center"><%=rs("spjiage1")%></td>
</tr>
<%rs.movenext
loop
%>
<tr bgcolor="#FFFFFF">
<td rowspan="2">合计:</td>
<td height="16" colspan="5"><%=rs("sptotal")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="16" colspan="5"><%response.write daxie(rs("sptotal"))%></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22"><table width="100%" border="0" align="center">
<tr>
<td width="36%">出库日期:<%=rs("spchukuday")%></td>
<td width="32%">经手人:<%=rs("spoperator")%></td>
<td width="32%">收货人:</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>


<% do while not rs.eof
%>
...

<%rs.movenext
loop
%>


就这个有事,一加进去就会有错:
ADODB.Field (0x80020009)
BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。


没加进循环还没写下一条记录~~

怎么办?帮下忙..
...全文
96 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
mhxz568 2006-04-20
  • 打赏
  • 举报
回复
我以前也经常碰到这种情况,只要知道病因就可以很好地解决问题了
fs2006 2006-04-20
  • 打赏
  • 举报
回复
HOHHOH,还是马小玲强,HOHOHO~~~~
mhxz568 2006-04-20
  • 打赏
  • 举报
回复
你需要一个判断语句,因为你的rs打开的是空值,因为没有记录操作
但你却用语句在操作,所以引起这个错误
在操作之前加个判断语句就因该没问题了
fs2006 2006-04-20
  • 打赏
  • 举报
回复
楼上的大虾,要没写DO,还怎么做循环..这不都是这么用的吗?我比较菜~~~
wanghui0380 2006-04-20
  • 打赏
  • 举报
回复
有鬼别怕,准备好钱,我马小铃前来捉鬼
呵呵,程序不是在循环中出的错,而是在循环后的下面这几句

<tr bgcolor="#FFFFFF">
<td rowspan="2">合计:</td>
<td height="16" colspan="5"><%=rs("sptotal")%></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="16" colspan="5"><%response.write daxie(rs("sptotal"))%></td>
</tr>

仔细想想把,循环结束时都rs.eof了,你还能访问rs码?
umbrella1984 2006-04-20
  • 打赏
  • 举报
回复
do while的工作原理你还不清楚

改成while顺便拿书看看基础吧
fs2006 2006-04-20
  • 打赏
  • 举报
回复
把这个改了也不管用呀..还是一样报错!!特烦..大吓们帮忙解决下了~~
jay_lishijie 2006-04-20
  • 打赏
  • 举报
回复
rs.open sql,conn,1,1
改成rs.open sql,conn,1,3

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧