当前位置: 首页 > 学习 > 电脑学习 > 网站开发 > ASP > ASP技巧 > 正文

一个简单的网上书城的例子(五)!

http://www.zk168.com.cn  招考学习网 2006-4-29 22:27:07
-----------------------------------------------------------[交流]-[打印]-[发送]-[收藏]--
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")%></TD>
<TD Align=Right><%=rs("Price")%></TD>
<TD><Input Type=Text Name="<%="Q_" & rs("ProductID")%>" Value=<%=Quatity%> Size=3></TD>
<TD Align=Right><%=CDbl(rs("Price"))*Quatity%></TD>
<TD><A HREF=<%=rs("Link")%>><%=rs("Description")%></A></TD>
</TR>
<%
      rs.MoveNext
   Wend
%>
<TR><TD Align=Right ColSpan=7><Font Color=Red>总价格=<%=Sum%></Font></TD></TR>
</TABLE>
<Input Type=Submit Value=" 更改数量 ">
</Form>
<HR width=80%>
<A HREF=Clear.asp>退回所有物品</A><P>
<% ListCategory conn %>
<HR width=80%>
<h2>顾客信息</h2>
<form action=BuyFinish.asp Method=POST>
姓名:<input Type=text  name=Customer_N Value=""><br>
电话:<input Type=text  name=Customer_T Value=""><br>
住址:<input Type=text  name=Customer_A Value=""><br>
<Input Type=hidden Name=Customer_P Value="<%=C_ProductID%>">
<Input Type=hidden Name=Customer_PN Value="<%=C_ProductName%>">
<Input Type=hidden Name=Customer_Q Value="<%=C_Quatity%>">
<Input Type=hidden Name=Customer_S Value="<%=Sum%>">
<Input Type=Submit Value=" 提交,完成一次购物. ">
</form><HR width=80%>
</CENTER>

</BODY>
</HTML>
-----------------------------------------------------------[交流]-[打印]-[发送]-[收藏]--
最新入库:
 
·实质、过程及意义——阿多尔诺“否定的辩证法”探微
·从Ontology的译名之争看哲学术语的翻译原则
·论马克思主义哲学经典的解释——解释学方法及其在马克
·中国哲学当前的核心与周边问题
·和合学与21世纪文化价值和科技
·中国文化的和合精神与21世纪
·宗教之间理当相互宽容
·上半个世纪的自由主义
·殷周至春秋时期神人关系之演进
·大学之道:构建以“三纲八目”为核心的道德修养体系
相关内容:
 
·中国网上广播的现状与前瞻
·用ASP实现科技成果的网上查询及管理
·互联网上的公司财务报告——中国上市公司财务信息网上
·我国网上证券经纪公司的设立与运作
·互联网上的公司财务报告——中国上市公司财务信息网上
·我国网上证券经纪公司的设立与运作
·互联网上的公司财务报告——中国上市公司财务信息网上
·我国网上证券经纪公司的设立与运作
·网上购买者是哪些人?
·哪些产品适合网上营销
网友点评:
 
会员名称:
密码:匿名 ·注册·忘记密码?
评论内容:
(最多300个字符)
  查看评论
友情提醒:
 1.库中的资料大都来自互联网、网友上传、各类书籍,在录入的过程中难免会出现错误,恳请网
 友来信指正!
 2.如果网友在本库中未能找到所需要的材料,请登陆到我们的论坛《招考学习网》版块!
 3.考友想加入招考学习网的编辑部,请发信到XueXiWang#Gmail.com(#改为@)附带个人简历
 4.如需转载请注明出处及作者,谢谢合作!
 5.如果您有更好的建议或意见请EMAIL:XueXiWang#Gmail.com (#改为@)
 6.凡标题中有注有“[NO]”字样均不含答案且答案整理中.
 7.如本库中转载文章涉及版权等问题,请相关网站或作者在两周内发邮件通知(EMAIL:  XueXiWang#Gmail.com (#改为@))我们,我们接到通知后立即删除该文章及链接!
你问我答 更多>>