<a href="javascript:search()" onclick="">查询</a>
要写在onclick中不需要javascript指令
<a href="#" onclick="search()return false">查询</a>
是odbc_clongshanion4.asp文件中数据库的问题odbc_clongshanion4.asp帖出来吧!
------------------------------------------------
在
db.Execute(SQL)
前面加上
response.write
SQL
response.end
看看
SQL语句
有没有问题
------------------------------------------------
如果是这样
,那么肯定是
odbc_clongshanion4.asp
中的问题了,有可能在打开数据库时候出的错误!
要是不麻烦,就帖出来,或者发到我的油箱:
leewycyp@yahoo.com.cn
分类: 电脑/网络 >>程序设计 >>其他编程语言问题描述:
高手们,帮帮忙看一下啦!!
Microsoft VBScript 运行时错误 错误 '800a0009'
下标越界: 'i'
Cart_List文件部分代码如下
<%
url=request.servervariables("_referer")
ProdIds = Session("ProdIds")
ProdNums = Session("ProdNums")
call up("购物车状态","购物车状态","购物车状态")
response.write "<tr>"
response.write " <td>"
response.write " <table border=1 width=100% cellpadding=4 style='border-collapse: collapse' bordercolor=#DFDFDF>"
response.write "<tr bgcolor=#f2f2f2><td>商品名称</td><td>市场价</td><td>网站价</td><td>订购数量</td><td>小计</td><td>删除</td></tr>"
response.write "<form action=Cart_List method=post name=form1 onsubmit=return CheckFrom()>"
response.write "<input type=hidden name=cmdShow value=Yes>"
if ProdIds<>"" then
aaa=split(ProdNums,",")
bbb=split(ProdIds,",")
pbuynums=Request("pbuynums")
Quatitys=split(Request("pbuynums"),",")
session("y")=ubound(bbb)+1
for i=0 to ubound(bbb)
set rs=server.createobject("adodb.recordset")
sql="select id,product_info_PriceM,product_info_PriceS,Shop_name from product where id="&bbb(i)
rs.open sql,conn,1,1
if rs.eof or rs.bof then
response.write "<tr><td colspan=6 align=center><a href='javascript:history.go(-1)'><<购物车为空,请返回选购商品</a></td></tr>"
else
set id=rs(0)
set product_info_PriceM=rs(1)
set RMB=rs(2)
set product_info_name=rs(3)
While Not rs.EOF
Quatity = Quatitys(i)
If Quatity <>"" Then
x=Quatity
else
x=aaa(i)
if aaa(i)="" then x=1
end if
sum1=sum1 + csng(rmb) * x
sum=FormatNumber(sum1,2,-1)
session("sum")=sum
response.write "<tr>"
response.write " <td><input type=hidden name=mc value="&id&"><a href=Product_Detail?id="&id&" target=_blank>"&Shop_name&"</a></td>"
response.write " <td>¥"&FormatNumber(product_info_PriceM,2,-1)&"</td>"
response.write " <td><font color=#FF0000>¥"&FormatNumber(Rmb,2,-1)&"</font></td>"
response.write " <td><input name=pbuynums value="&x&" size=5 maxlength=5></td>"
response.write " <td>¥"&FormatNumber((csng(rmb)*x),2,-1)&"</td>"
response.write " <td><a href=Cart_Del?MyAction=Del&id="&id&">删除</a></td>"
response.write "</tr>"
rs.MoveNext
Wend
end if
rs.close
set rs=nothing
next
%>
解析:
有问题的部分:
aaa=split(ProdNums,",")
bbb=split(ProdIds,",")
问题:你能保证 aaa、bbb 通过 Split 函数分割出来的数组下标完全一致?若不一致因该在调用前检查一下,问题就出现在这里。
调试:
Response.Write aaa &"<br>" &bbb
Response.End
这样输出一下 aaa、bbb 值看看是否正确。
修改:
你没给出发生错误的位置,我根据代码推断因该是以下代码发生错误:
x=aaa(i)
if aaa(i)="" then x=1
这段代码改为
If i >UBound(aaa) Then
x = 1
ElseIf aaa(i) = "" Then
x = 1
Else
x = aaa(i)
End If
欢迎分享,转载请注明来源:优选云