为了账号安全,请及时绑定邮箱和手机立即绑定

在asp中类型不匹配: 'UBound' 这是为什么呢?

在asp中类型不匹配: 'UBound' 这是为什么呢?

aluckdog 2022-04-01 11:07:38
报错内容是:Microsoft VBScript 运行时错误 错误 '800a000d'类型不匹配: 'UBound'/incs/config.asp,行 1197config.asp第1197行的内容是:for tempc=0 to ubound(tempvar)以下是部分内容:function getwebnav(byval pdttpe,byval pcid)if not chk_int(pcid) thenpcid=SafeRequest("pcid")end iftempvar=application("pl_menu_"&pdttpe)for tempc=0 to ubound(tempvar)tempv=tempvar(tempc)if instr(tempv,":") thentemppcid=getvalsec(tempv,":",1)if not chk_int(pcid) thenpdtclsnme=getvalsec(tempv,":",2)pcid=temppcidexit forelseif cint(pcid)=cint(temppcid) thenpdtclsnme=getvalsec(tempv,":",2)exit forend ifend ifnextsession("pdtclsnme")=pdtclsnmesession("pcid")=pcidtempvs=application("pl_menutpe")for myi=0 to ubound(tempvs)tempv=tempvs(myi)if lcase(left(tempv,3))=lcase(pdttpe) thentempp=right(tempv,len(tempv)-instr(tempv,":"))tempp=left(tempp,instr(tempp,":")-1)session("pdttpenme")=temppend ifnextend function
查看完整描述

2 回答

?
慕容森

TA贡献1853条经验 获得超18个赞

比如你定义变量int num;这个num是整型,而你却要给这个num赋值num="a";这样就会报错,因为a不属于整型,无法进行加减运算等。
你这个应该是哪个变量的类型是UBound,而你将它赋值为其它类型或是与其它类型比较。
相当于问你a和1哪个大,a是字母,1是数字,两个是不能进行比较的,也就是类型不一样。

查看完整回答
反对 回复 2022-04-07
?
12345678_0001

TA贡献1802条经验 获得超5个赞

在这句for tempc=0 to ubound(tempvar)之前要先用 Split将tempvar进行分割后才能用ubound来计算数组大小

例:
tempvar="a,b,c"
tempvar=Split(tempvar,",")
for tempc=0 to ubound(tempvar)
Response.Write tempvar(tempc)
next

查看完整回答
反对 回复 2022-04-07
  • 2 回答
  • 0 关注
  • 362 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信