循环里的数组 求 ?????????????

w915 2008-12-21 05:31:14
由于要计算 想在 显示数据库的记录的时候 给一个数组赋值
代码 dim a()
do while not rs.eof
i=0
a(i)=rs("sss")*0.15
rs.movnext
i=i+1
loop
...全文
70 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
-晴天 2008-12-22
  • 打赏
  • 举报
回复
 dim a() 
i=0
do while not rs.eof
redim preserve a(i)
a(i)=rs("sss")*0.15
rs.movnext
i=i+1
loop
Dogfish 2008-12-22
  • 打赏
  • 举报
回复
i=0放错位置了。
jiang_jiajia10 2008-12-21
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 myvicy 的回复:]
a = rs.GetRows(-1)
[/Quote]
UP
myvicy 2008-12-21
  • 打赏
  • 举报
回复
a = rs.GetRows(-1)
toury 2008-12-21
  • 打赏
  • 举报
回复

<%
dim i,temp,a()
i=0
do while not rs.eof
Redim preserv a(i)
temp=rs("sss")&""
if temp="" then temp=0
a(i)=temp*0.15
i=i+1: temp=0
rs.movnext
loop
%>


最好用 4楼的rsArray = rs.getRows(-1)
lzp4881 2008-12-21
  • 打赏
  • 举报
回复
<%
dim a()
i=0
do while not rs.eof
Redim a(i)
a(i)=rs("sss")*0.15
rs.movnext
i=i+1
loop
%>
文盲老顾 2008-12-21
  • 打赏
  • 举报
回复
为什么这样写?
dim rsArray
set rs = conn.execute("select * .....")
if not rs.eof then
rsArray = rs.getRows(-1)
end if

直接取成二维数组不是更好么?
zjsfdxbao 2008-12-21
  • 打赏
  • 举报
回复
你的rs("sss")肯定有空值,加些判断吧
w915 2008-12-21
  • 打赏
  • 举报
回复
Microsoft VBScript 运行时错误 错误 '800a000d'
类型不匹配

/Items.asp,行 78

、、、、、、、、、、、、在进行下一个循环的时候 出现???????????????????????????
zjsfdxbao 2008-12-21
  • 打赏
  • 举报
回复

dim a(100)'记得VB需要定义数组大小吧
i=0
do while not rs.eof
'i=0 该行移到循环外
a(i)=rs("sss")*0.15
rs.movnext
i=i+1
loop

28,391

社区成员

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

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