日期:2013-06-05  浏览次数:20886 次

check.asp:用户察看所购物品!

<!--#include file="Util.asp" -->

<%
Head="以下是您所选购的物品清单"

ProductList = Session("ProductList")
If Len(ProductList) = 0 Then Response.Redirect "Nothing.asp"

DbPath = SERVER.MapPath("ShopBag.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath

If Request("MySelf") = "Yes" Then
   ProductList = ""
   Products = Split(Request("ProductID"), ", ")
   For I=0 To UBound(Products)
      PutToShopBag Products(I), ProductList
   Next
   Session("ProductList") = ProductList
   Session("First")="no"
End If

sql = "Select * From Products"
sql = sql & " Where ProductID In (" & ProductList & ")"
sql = sql & " Order By ProductID"
Set rs = conn.Execute( sql )
%>

<HTML>
<HEAD><TITLE><%=Head%></TITLE></HEAD>
<BODY BACKGROUND="b01.jpg">
<H2 ALIGN=CENTER><%=Head%></H2>
<CENTER>
<Form Action=Check.asp Method=POST>
<Input Type=Hidden Name=MySelf Value=Yes>
<TABLE Border=1>
<TR BGCOLOR=#00FFFF>
<TD>取消</TD><TD>书刊编号</TD><TD>书刊名称</TD><TD>单价</TD><TD>数量</TD><TD>总价</TD><TD>商品简介</TD></TR>
<%
   Sum = 0
   C_ProductID=""
   C_Quatity=""
   While Not rs.EOF
    if Session("First")="yes" then
      Quatity=1
    else    
     Quatity = CInt( Request( "Q_" & rs("ProductID")) )
     If Quatity <= 0 Then
        Quatity = CInt( Session(rs("ProductID")) )
        If Quatity<=0 Then Quatity = 1
     End If
     end if
     Session(rs("ProductID")) = Quatity
     Sum = Sum + CDbl(rs("Price")) * Quatity
     
    If Len(C_ProductID) = 0 Then
       C_ProductID = "" & rs("ProductID") & ""
       C_ProductName = "" & rs("ProductName") & ""
       C_Quatity = "" & Quatity & ""
     Else
       C_ProductID =  C_ProductID & "/" & rs("ProductID") & ""
       C_ProductName =  C_ProductName & "/" & rs("ProductName") & ""
       C_Quatity = C_Quatity & "/" &  Quatity & ""
     End If     

     
%>
<TR>
<TD Align=Center>
<Input Type=CheckBox Name="ProductID" Value="<%=rs("ProductID")%>" Checked>
</TD>

<TD><%=rs("ProductID")%></TD>
<TD><%=rs("ProductName")%&