问个问题,asp语言,想不通那里错了,大家看下,关于产品数量的那一块

来源:百度知道 编辑:UC知道 时间:2024/05/28 15:31:49
<form Action="Eshop.asp" Method="POST" onSubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<input type="hidden" name="MySelf" value="Yes">
<div align="center"><center>
<table border="0" cellspacing="1" width="100%" cellpadding="0" bgcolor="#666666">
<tr>
<td align="center" width="132" height="22" bgcolor="#999999"><font color="#FFFFFF">产品编号</font></td>
<td align="center" width="301" height="22" bgcolor="#999999"><font color="#FFFFFF">产品名称</font></td>
<td align="center" width="120" height="22" b

1) Quatity = CLng( Request( "Q_" & rs("Pro_number")) )
2) If Quatity <= 0 Then
3) Quatity = CLng(Session(rs("Pro_number")))
4) If Quatity <= 0 Then Quatity = 1
5) End If
6)Session(rs("Pro_number")) = Quatity

1) 假设参数传过来赋值给 Quatity = -5
2)进入if
3)Session值不存在,clng结果=0 Quatity =0
4)Quatity =1
5)结束
6)Session=1

第三行 第一次执行的时候 session值不存在,或者session超时造成的 Quatity =1,session=1。

以后的循环:
3)session=1,clng=1,Quatity =1
4)跳过

因此第一行如果不带参数,或者传来的是小于0的,那Quatity一直等于1
-----------
啰嗦一堆,总之要么 Request( "Q_" & rs("Pro_number"))传个有效值过来,要么前面页面 Session(rs("Pro_number"))就赋值过了,就不会等于1了。

空值 小于0的