类型不匹配问题~

lbee286 2008-03-15 09:51:33
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>添加到购物车</title>
</head>
<body>
<!--#include file="../dbconn.inc"-->
<%
if session("username")="" then%>
<p><cerent>游客您好,您还未<a href="adduser.asp">注册</a>或<a href="netbook.asp">登录</a></cerent></p>
<%
else
dim conn,rs,sql,htmlcode
arrcart=session("mycart")
cartindex=session("cartindex")
bookid=Request.QueryString("bookid")
call openDB()
sql="select * FROM books WHERE bookid ='"&bookid&"'"
rs.open sql,conn,1,1
count=0
for i=0 to cartindex
if arrcart(i,2)<>"" then
if arrcart(i,2)>0 then
count=count+1
end if

end if
next
if count =50 then
response.write "购物车已满!"
end if
if cint(rs("stock"))>0 then
arrcart(cartindex,0)=bookid
arrcart(cartindex,1)=rs("bookname")
arrcart(cartindex,2)=1
arrcart(cartindex,3)=rs("price")
session("mycart")=arrcart
cartindex=cartindex+1
session("cartindex")=cartindex
response.redirect "showcart.asp"
else
htmlcode="操作失败,库书数量不足"
response.write htmlcode&"<a href=booklist.asp>返回</a>"
end if
call closeDB()
end if
%>
</body>
</html>
错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'arrcart'
/site/maozhong/mao3/user/addcart.asp, 第 23 行
老是出现这个问题,望哪个德高望重的大侠给小弟解释下~谢谢了
...全文
54 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
要确保cartindex是整数
  • 打赏
  • 举报
回复
cartindex=int(session("cartindex"))
或者
for i=0 to int(cartindex)
  • 打赏
  • 举报
回复
if int(arrcart(i,2))> 0 then
count=count+1
end if
lbee286 2008-03-15
  • 打赏
  • 举报
回复
大哥改了还是不行呀~~能在想想办法吗 谢谢了~

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧