日期:2014-05-17  浏览次数:20751 次

数组赋值问题 高手帮忙看一下
for   i=1   to   rs.fields.count
Response.Write   rs.fields(i).value& " <br> "
db(i)=rs.fields(i).value
next
我想通过上面的方法把数据库内的值赋给db数组,但结果是db里面的值是空的,并且我用ubound(db)来检测db的上限时值也是空的,为什么?那位高手能不能帮忙解答一下??


------解决方案--------------------
dim db(rs.fields.count)
for i=1 to rs.fields.count
Response.Write rs.fields(i).value& " <br> "
db(i)=rs.fields(i).value
next
------解决方案--------------------
dim db()
redim db(rs.recordCount)
for i=0 to rs.recordCount-1
Response.Write rs.fields(i).value& " <br> "
db(i)=rs.fields(i).value
next
------解决方案--------------------
dim db()
for i=0 to rs.recordCount-1
redim preserve db(rs.recordCount)
Response.Write rs.fields(i).value& " <br> "
db(i)=rs.fields(i).value
next