ASP页面读取数据替换数组问题,请求帮忙。
<%
AAA1= round((rs("求和A1")),2)
AAA2= round((rs("求和A2")),2)
AAA3= round((rs("求和A3")),2)
......
......
AAA12= round((rs("求和A12")),2)
total(1,1)="0,950,725,635,435,258,865,458,955,152,845,425,421"
然后把total(1,1)="0,后面替换如下:
total(1,1)="0,AAA1,AAA2,AAA3,AAA4,AAA5,AAA6,AAA7,AAA8,AAA9,AAA10,AAA11,AAA12"
现数据读不出来,请教下,如何才能在total(1,1)="0,后面,就是把total(1,1)="0,后面的数字,用上面AAA1读出的数据代替。AAA1,AAA2....已经确认是有数据的。。
------解决方案--------------------total(1,1)="0,950,725,635,435,258,865,458,955,152,845,425,421"
ar = split(total(1,1),",")
for i=1 to ubound(ar)
ar(i) = eval("aa" & i)
next
total(1,1)= join(ar,",")
------解决方案--------------------total(1,1)="0,"&AAA1&","&AAA2&".....,"&AAA11&","&AAA12
=================================或者==============================
节省代码写法:
dim a="0"
for i=1 to 12
a=a&round((rs("求和A"&i)),2)
next
total(1,1) = a