学习途中,做到订单系统哪方面,购物车,订单都已经建立完成。
但是我在用户中心那里添加一个查询购物车的页面,就获取不了SESSION的值,不知道为甚么
代码基本跟购物车的一样,购物车都能获取,不知道为甚么换了个页面就获取不了
- HTML code
<% sub addtocart() ProductList = Session("ProductList") Products = Split(Request("Prodid"), ",") For I=0 To UBound(Products) PutToShopBag Products(I), ProductList Next Session("ProductList") = ProductList if request("payment")="去收银台" then response.redirect "b2b_ddlcsys.asp?action=1" end if If Request("cmdShow") = "Yes" Then ProductList = "" Products = Split(Request("ProdId"), ", ") For I=0 To UBound(Products) PutToShopBag Products(I), ProductList Next Session("ProductList") = ProductList End If If Len(Session("ProductList")) = 0 Then end if %> <% Set rsCheck=Server.CreateObject("ADODB.RecordSet") strsql="select id,name,price,amount,stock from Product where ID in ("&Session("ProductList")&") order by ID" rsCheck.open strsql,conn,1,1 %> <link href="b2b_includefile/css.css" rel="stylesheet" type="text/css"> <table width="96%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <form action="check.asp" method="POST" name="check"><td> <table border="0" cellspacing="1" cellpadding="4" align="center" width="100%" bgcolor="#f2f2f2"> <tr bgcolor="#f7f7f7" height="25" align="center"> <td width="40"><strong>编 号</strong></td> <td width="300"><strong>商 品 名 称</strong></td> <td width="40"><strong>数量</strong></td> <td width="60"><strong>成交价</strong></td> <td width="70"><strong>总 计</strong></td> </tr> <% Sum = 0 Quatity = 1 Do While Not rsCheck.EOF Quatity = CInt( Request.Form( "Q_" & rsCheck("ID")) ) If Quatity <= 0 Then Quatity = CInt( Session(rsCheck("ID")) ) If Quatity <= 0 Then Quatity = 1 End If Session(rsCheck("ID")) = Quatity IF rsCheck("Stock") < Quatity Then Quatity = 1 Session(rsCheck("ID")) = 1 response.write "<script language=javascript>alert('对不起,"&rsCheck("Name")&"暂时库存不足!');window.close();</script>" Response.End() Conn.Close Set Conn = Nothing End IF Dim Price Price = Round(rsCheck("Price"),2) Sum = Sum + price*Quatity Sum=Round(Sum,2) %>
最后25分,散出去啦
Microsoft OLE DB Provider for SQL Server (0x80040E14)
第 1 行: ')' 附近有语法错误。
/网站5/disuser.asp, 第 33 行
也就是
Set rsCheck=Server.CreateObject("ADODB.RecordSet")
strsql="select id,name,price,amount,stock from Product where ID in ("&Session("ProductList")&") order by ID"
rsCheck.open strsql,conn,1,1
经过输出测试,发觉("&Session("ProductList")&") 没有值
可是就不知道那里错了,高人指点下。。
石头大哥啊!!!
------解决方案--------------------
<%
sub addtocart()
ProductList = Session("ProductList")
Products = Split(Request("Prodid"), ",")
For I=0 To UBound(Products)
PutToShopBag Products(I), ProductList
Next
Session("ProductList") = ProductList
if request("payment")="去收银台" then