最近在写一个购物车,遇到问题,请大家帮忙

chazikai24 2010-05-24 10:27:04
由商品页面点击订购进入购物车时显示错误代码500.100
单独打开这个asp,则能正常显示您还未选购商品。本来已经成功实现了这个功能,后来我在ACCESS数据库中改了一个表,把原来一个P_no删除了。数据库中是存在Product_Id的项的,求解,哪里有错误?
程序代码如下:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="util.asp" -->
<!--#include file="conn.asp" -->
<%
ProductList = Session("ProductList")
Products = Split(Request("cpbm"), ", ")
For i=0 To UBound(Products)
PutToShopBag Products(i), ProductList
Next
Session("ProductList") = ProductList

Head="以下是您所选购的物品清单"
'ProductList = Session("ProductList")
If Len(ProductList) =0 Then
Response.Redirect "Nothing.asp"
response.end
end if

'If Request("MySelf") = "Yes" Then
' ProductList = ""
' Products = Split(Request("cpbm"), ", ")
' For I=0 To UBound(Products)
' PutToShopBag Products(I), ProductList
' Next
' Session("ProductList") = ProductList
'End If
'If Len(ProductList) = 0 Then
' Response.Redirect "Nothing.asp"
' response.end
'end if

set rs=server.createobject("adodb.recordset")
sql = "Select * From Product"
sql = sql & " Where Product_Id In (" & ProductList & ")"
rs.open sql,conn,3,3
%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>.main {
FONT-SIZE: 9pt
}
.main1 {
FONT-SIZE: 14px
}

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>.main {
FONT-SIZE: 9pt
}
.main1 {
FONT-SIZE: 14px
}

</STYLE>
<title>以下是您所选购的物品清单</title>
</head>
<script language="Javascript">
//函数名:fucCheckNUM
//功能介绍:检查是否为数字
//参数说明:要检查的数字
//返回值:1为是数字,0为不是数字
function fucCheckNUM(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
{
//说明有字符不是数字
return 0;
}
}
//说明是数字
return 1;
}

function clean()
{
window.location.href="clear.asp";
}
</script>
<SCRIPT language=javascript id=clientEventHandlersJS>
<!--
function form1_onsubmit(v)
{
newprice="Q_" & rs("Product_Id")
if ((fucCheckNUM(document.FORM1.newprice.value)==0) )
{ alert ("会员价有非法字符,请填写正确会员价。");
document.FORM1.newprice.focus();
return false;
}
//-->
}
</SCRIPT>
<body topmargin="5" bgcolor="#E6E4C4">
<div align="center"><center>

<table width="100%" border="0" cellspacing="0">
<tr>
<td width="80%" valign="top"><p align="center">
<font color="#FF0000" class=main1><%=Head%></font></p>
<form Action="Check.asp" Method="POST" onSubmit="return form1_onsubmit()">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="1" cellpadding="0" cellspacing="0" width="614" bordercolor="#008000" bordercolorlight="#008000" bordercolordark="#FFFFFF" class=main>
<tr bgcolor="#6d8e4d">
<td align="center" width="46" height="22"><font color="#FFFFFF">商品编号</font></td>
<td align="center" width="140" height="22"><font color="#FFFFFF">商品名称</font></td>
<td align="center" width="58" height="22"><font color="#FFFFFF">商品价格</font></td>
<td align="center" width="64" height="22"><font color="#FFFFFF">商品数量</font></td>
<td align="center" width="77" height="22"><font color="#FFFFFF">剩余数量</font></td>
<td align="center" width="48" height="22"><font color="#FFFFFF">购买</font></td>
<td align="center" width="165" height="22"><font color="#FFFFFF">总价</font></td>
</tr>
<%
Sum = 0
While Not rs.EOF
Quatity = CInt( Request( "Q_" & rs("Product_Id")) )
If Quatity <= 0 Then
Quatity = CInt( Session(rs("Product_Id")) )
If Quatity <= 0 Then Quatity = 1 end if
End If
Session(rs("Product_Id")) = Quatity
Sum = Sum + ccur(rs("P_NewPrice")) * Quatity
%>
<tr>
<td align="center" width="46"><%=rs("Product_Id")%></td>
<td align="center" width="140"><%=rs("Product_Name")%></td>
<td align="center" width="58"><%=rs("P_NewPrice")%></td>
<td align="center" width="64"><!--webbot bot="Validation"
S-Display-Name="请输入正确的商品数量!"
S-Data-Type="Integer" S-Number-Separators="x" -->
<input Name="<%="Q_" & rs("Product_Id")%>" Value="<%=Quatity%>" Size="3"></td>
<td Align="center" width="77"><%=ccur(rs("P_num"))-Quatity%>件</td>
<td Align="center" width="48"><input Type="CheckBox" Name="cpbm" Value="<%=rs("Product_Id")%>" Checked></td>
<td Align="center" width="165"><%=ccur(rs("P_NewPrice"))*Quatity%>.00元</td>
</tr>
<%
rs.MoveNext
Wend
%>
<tr>
<td height="30" ColSpan="7" Align="Right"><font Color="Red">总价格=人民币 <%=Sum%>.00元</font></td>
</tr>
</table>
</center></div>
<blockquote>
<p align="center">
<input Type="submit" Value="数量更改" name="B1" onsubmit="">   
<input type="button" value="继续购物" name="B2" onClick="window.close();" style="font-size: 9pt">   
<input type="button" value="订单取消" name="B3" OnClick="clean()" style="font-size: 9pt">   
<input type="button" value="去收银台" name="B4" onClick="window.opener.location.href='PayMent.asp';window.close();" style="font-size: 9pt">
<p align="center"><font Color="Red">为了您能成功购买,填写购买数量应小于库存数量,谢谢!</font>
</blockquote>
</form>
</center>
</td></tr></table>
<%
rs.close
conn.close
%>

</body>
</html>
...全文
223 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wzn1987 2010-05-25
  • 打赏
  • 举报
回复
注意看了你包含进去的网页了吗?如果本页面没问题的话要注意看看你包含进去的网页有问题没
chazikai24 2010-05-25
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 daxuejianku 的回复:]
VBScript code
你问题表述不清楚。
你到底是删除了哪个。
把原来一个P_no删除了。数据库中是存在Product_Id的项的?
这句话怎么解释。
你如果删除了Product_Id
那么出现Product_Id得都可能错误。。
[/Quote]

表中本来有P_no(自动编号,只是作为序号而已),还有product_Id(商品的编号),我把P_no删除了,但是我检查了上述代码,其中没涉及到P_no的啊。
yifanwu 2010-05-25
  • 打赏
  • 举报
回复
你把表列删了,程序又没有改,当然要出错啦
北京不不 2010-05-25
  • 打赏
  • 举报
回复
你问题表述不清楚。
你到底是删除了哪个。
把原来一个P_no删除了。数据库中是存在Product_Id的项的?
这句话怎么解释。
你如果删除了Product_Id
那么出现Product_Id得都可能错误。。
KFCILIKEIT 2010-05-25
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 yifanwu 的回复:]
你把表列删了,程序又没有改,当然要出错啦
[/Quote]
改了数据库,代码不给能对吗?

28,391

社区成员

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

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