一个asp简单购物车教程
时间:2007-09-17 11:02:00
asp之家注:如果你学习过asp,并且在网络公司上过班,一定会接触到网购系统,网购系统可以说是一个典型的程序类型,而其中最重要,也是最关键的程序就是:如何处理购物车,以及订单的处理。就我别人来说也做过不少购物系统,有中文也有英文的,而购物车的核心个人觉得就是如何保存购物车的内容。我使用过session,也使用过cookies,这个看客户需求而定,本文介绍了一个asp购物车的系统,相信对刚接触这类程序的人有所帮助!
数据库字段
表:pro_talbe:
id 产品编号
proname 产品名称
simages 产品小图
表o_rder:
id 订单编号
p_roid 产品编号
m_um 产品数量
d_time 订购时间
表co_table:
id 客户编号
nn_ame 客户姓名
tt_el 联系电话
ee_m_ail 客户邮箱
index.asp源码
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn.asp" -->
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM pro_table"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="583" border="0" cellspacing="0" cellpadding="0">
<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td width="140"><%=(Recordset1.Fields.Item("id").Value)%></td>
<td width="171"><%=(Recordset1.Fields.Item("proname").Value)%></td>
<td width="272"><%=(Recordset1.Fields.Item("simages").Value)%></td>
<td width="272"><a href="cart.asp?ProductID=<%=(Recordset1.Fields.Item("id").Value)%>&quantity=1">购买</a></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
Recordset1.Close()
%>
列出产品,这里有一个要点就是:
<a href="cart.asp?ProductID=<%=(Recordset1.Fields.Item("id").Value)%>&quantity=1">购买</a>
这里传递了两个参数:产品ID“ProductID" 数量:“quantity"
标签:购物车,asp
0
投稿
猜你喜欢
Firefox的默认样式表
2008-05-09 12:06:00
SQL Server中应当怎样得到自动编号字段
2009-01-15 12:48:00
用asp获取微软安全更新列表的代码 小偷程序
2011-02-24 11:19:00
你是真正的用户体验设计者吗? Ⅵ
2008-04-19 18:23:00
傲游对开发人员的影响越来越大了
2009-10-14 13:16:00
不受欢迎的“欢迎页”
2008-04-20 16:41:00
用ASP实现Google在线文章翻译的功能
2008-10-11 13:55:00
如何设计注册激活邮件
2010-01-12 13:14:00
Linux上MySql远程备份方案
2010-11-25 17:23:00
sqlserver 中时间为空的处理小结
2011-11-03 17:16:17
javascript阻止事件冒泡和浏览器的默认行为
2007-12-28 13:13:00
网站有效设计的10个原则
2008-02-11 17:12:00
关于交互设计在QQ秀赠送流程中的优化
2009-06-11 12:30:00
纠结于ajax开发中 response的contentType 问题
2008-12-11 13:46:00
ACCESS中Field对象的标题属性
2008-11-20 17:44:00
为网页设计创建有效的配色方案
2011-08-31 12:55:57
用ASP动态生成JS表单验证代码
2007-09-30 20:38:00
asp如何对欲删除的记录确认后再删除?
2009-11-20 18:48:00
页面软键盘汉字输入
2010-09-01 20:41:00
Oracle 忘记密码的找回方法
2009-03-06 11:12:00