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

网络整理 - 07-26
buy.asp:显示商品和用户购物!

<!--#include file="Util.asp" -->
<%
DbPath = SERVER.MapPath("ShopBag.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DbPath

CategoryID=Request("CategoryID")
Description=Request("Description")
Head="会文书城[" & Description & "] 区"

sql = "Select * From Products Where CategoryID=" & CategoryID
sql = sql & " Order By ProductID"
Set rs = conn.Execute( sql )

%>


<HTML>
<HEAD><TITLE><%=Head%></TITLE></HEAD>
<BODY BACKGROUND="b01.jpg">
<font color=blue><H2 ALIGN=CENTER><%=Head%></H2></font>
<CENTER>
<Form Action=Add.asp Method=POST>
<TABLE Border=1>
<TR BGCOLOR=#00FFFF>
<TD>挑选</TD><TD>书刊编号</TD><TD>书刊名称</TD><TD>价格</TD><TD>书刊简介</TD></TR>
<%
   While Not rs.EOF
     IsCheck=""
     If InStr(Session("ProductList"), rs("ProductID")) > 0 Then
        IsCheck="Checked"
     End If
%>
<TR>
<TD Align=Center>
<Input Type=CheckBox Value="<%=rs("ProductID")%>" <%=IsCheck%>>
</TD>

<TD><%=rs("ProductID")%></TD>
<TD><%=rs("ProductName")%></TD>
<TD Align=Right><%=rs("Price")%></TD>
<TD><A HREF=<%=rs("Link")%>><%=rs("Description")%></A></TD>
</TR>
<%
      rs.MoveNext
   Wend
%>
</TABLE>
<Input Type=Submit Value="放入购物袋">
</Form>
<HR width=70%>
<A HREF=Check.asp>查看购物袋</A>  
<A HREF=Clear.asp>退回所有物品</A><P>
<% ListCategory conn %>
</CENTER>
</BODY>
</HTML>