请各位大侠帮帮忙吧!!
错误类型:
Microsoft VBScript 运行时错误 (0x800A0009)
下标越界: '[number: 1]'
/test3/checkvote.asp, 第 15 行
是这行:vote(1)=vote(1)
代码如下:
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from votes"
rs.open sql,conn,1,3
vote=split(rs("vote"),",")
if request.Form("xml1")="" then
vote(0)=vote(0)
elseif request.Form("xml1")="1" then
vote(0)=vote(0)+1
rs("all")=rs("all")+1
end if
if request.Form("xml2")="" then
vote(1)=vote(1)
elseif request.Form("xml2")="1" then
vote(1)=vote(1)+1
rs("all")=rs("all")+1
end if
if request.Form("xml3")="" then
vote(2)=vote(2)
elseif request.Form("xml3")="1" then
vote(2)=vote(2)+1
rs("all")=rs("all")+1
end if
if request.Form("xml4")="" then
vote(3)=vote(3)
elseif request.Form("xml4")="1" then
vote(3)=vote(3)+1
rs("all")=rs("all")+1
end if
if request.Form("xml5")="" then
vote(4)=vote(4)
elseif request.Form("xml5")="1" then
vote(4)=vote(4)+1
rs("all")=rs("all")+1
end if
rs("vote")=""&vote(0)&","&vote(1)&","&vote(2)&","&vote(3)&","&vote(4)&","
rs.update
rs.close
set rs=nothing
response.write "<script language=javascript> alert('投票成功!');location.replace('view.asp');</script>"
response.end
%>
小弟先谢了~~
<%
'set rs=server.CreateObject("adodb.recordset")
'sql="select * from votes"
'rs.open sql,conn,1,3
dim vote
'vote=split(rs("vote"),",")
vote = Array(1,2,3,4,5)
if request.Form("xml1")="" then
vote(0)=vote(0)
elseif request.Form("xml1")="1" then
vote(0)=vote(0)+1
'rs("all")=rs("all")+1
end if
if request.Form("xml2")="" then
vote(1)=vote(1)
elseif request.Form("xml2")="1" then
vote(1)= cint(vote(1))+1
'rs("all")=rs("all")+1
end if
if request.Form("xml3")="" then
vote(2)=vote(2)
elseif request.Form("xml3")="1" then
vote(2)=vote(2)+1
'rs("all")=rs("all")+1
end if
if request.Form("xml4")="" then
vote(3)=vote(3)
elseif request.Form("xml4")="1" then
vote(3)=vote(3)+1
'rs("all")=rs("all")+1
end if
if request.Form("xml5")="" then
vote(4)=vote(4)
elseif request.Form("xml5")="1" then
vote(4)=vote(4)+1
'rs("all")=rs("all")+1
end if
'rs("vote")=""&vote(0)&","&vote(1)&","&vote(2)&","&vote(3)&","&vote(4)&","
'rs.update
'rs.close
'set rs=nothing
'response.write "<script language='javascript'> alert('投票成功!');location.replace('view.asp');</script>"
response.end
%>
我这样帮你测试了一下,
下界越标的可能原因是,
你的rs("vote")里面没有足够的值来装载数组.
你先把rs("vote")的内容输出看看是什么.
与你想要的数组是否相符.
先排除数据源的问题.
这个问题就是数组越界问题,原因是你的vote数组中只有一个元素,那么你访问vote(1)的时候就会报错。
另外,vb最好使用IE的调试工具,使用方法如下:
http://www.cnblogs.com/killmyday/archive/2009/09/08/1562259.html
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息