asp数组问题
数据库为accessper字段类型为备注per字段值是1100,2100,2101,2102,2103,3100,3101,3102,4100,8100<%dimAA,n...
数据库为access
per字段类型为备注
per字段值是1100,2100,2101,2102,2103,3100,3101,3102,4100,8100
<%dim AA,num
set Rs=conn.Execute("Select * from manager where userid='234'")
num =1100
kl=rs("per")
AA = Array(kl)
for i = 0 to ubound(AA)
if num=AA(i) then
response.write("该数值在数组中!")
exit for
end if
next
rs.close
set rs=nothing
%>
为什么的循环写出来输不出结果啊
求高手解答 展开
per字段类型为备注
per字段值是1100,2100,2101,2102,2103,3100,3101,3102,4100,8100
<%dim AA,num
set Rs=conn.Execute("Select * from manager where userid='234'")
num =1100
kl=rs("per")
AA = Array(kl)
for i = 0 to ubound(AA)
if num=AA(i) then
response.write("该数值在数组中!")
exit for
end if
next
rs.close
set rs=nothing
%>
为什么的循环写出来输不出结果啊
求高手解答 展开
2个回答
展开全部
Rs("per")这是一个字符串,你需要分隔后存储到数组中
========================
代码如下:
dim AA,num
set Rs=conn.Execute("Select * from manager where userid='234'")
num =1100
kl=rs("per")
AA = Split(k1,",") '修改这里将字符串数据分离到数组中
for i = 0 to ubound(AA)
if CStr(num)=CStr(AA(i)) then '这里注意数据类型一致
response.write("该数值在数组中!")
exit for
end if
next
rs.close
set rs=nothing
========================
代码如下:
dim AA,num
set Rs=conn.Execute("Select * from manager where userid='234'")
num =1100
kl=rs("per")
AA = Split(k1,",") '修改这里将字符串数据分离到数组中
for i = 0 to ubound(AA)
if CStr(num)=CStr(AA(i)) then '这里注意数据类型一致
response.write("该数值在数组中!")
exit for
end if
next
rs.close
set rs=nothing
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询