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

asp如何接收函数返回的数组,请进来看看,多谢!
asp如何接收函数返回的数组,请进来看看,多谢!

函数中我是这样写的
dim   array(1)
function   getv(aa,bb)
array(0)= "bbb "
array(1)= "cccc "
end   function


r=getv(1,2)     接收时出现错误




------解决方案--------------------
dim a(1)
function getv(aa, bb)
a(0) = "aaa "
a(1) = "bbb "
getv = a
end function

dim r
r = getv(1, 2)

for i = 0 to ubound(r)
response.write r(i) & " <br> "
next

不要用array作变量名

------解决方案--------------------
Dim rArray,i,j
function getv(aa,bb)
' '自行加aa,bb的数据类型判断
dim TempArray
redim TempArray(aa,bb)
for i=0 to aa
for j=0 to bb
TempArray(i,j)=i& ", "&j
next
next
getv=TempArray
end function

rArray=getv(1,2)

for i=0 to 1
for j=0 to 2
response.write rArray(i,j)& " <br> "
next
next
------解决方案--------------------
dim a(1)
function getv(aa, bb)
a(0) = aa
a(1) = bb
getv = a
end function

dim r
r = getv(1, 2)
//三楼的可以呀
for i = 0 to ubound(r)
response.write r(i) & " <br> "
next