求教数组取值替换问题
数据库用有一个字段a1为数组,表单提交数据中有个字段a2,a2表示数组中对应的位数
a1=0,0,0
a2=0,2
通过表单 a2 提交的数据改变第0位,第2位的数据。将a1替换成a1=1,0,1
请问大家用asp如何实现?
prids=split(a1,",")
prtuihuoId=split(a2,",")
m=ubound(prtuihuoId)
n=ubound(prids)
for j=0 to m
for i=0 to n
if i=j then
prtuihuoIDs=prtuihuoIDs&","&Replace(prids(prtuihuoId(j)),"0","1")
else
prtuihuoIDs=prtuihuoIDs&","&prids(i)
end if
next
next
------解决方案--------------------
VB code
prids=split(a1,",")
prtuihuoId=split(a2,",")
for i=0 to ubound(prtuihuoId)
prids(prtuihuoId(i))=1
next
prtuihuoIDs=join(prids,",")