首页 | 免费域名 | 个人服务器 | 一流信息监控拦截系统 | 虚拟主机知识库 | ASP 空间 | ASP技术大全 | 下载中心 | 客户服务中心
  7i24 > ASP技术大全 > 代码乐园 >
    7i24 .Com  
  同时订购多样物品的源程序

7i24.Com不停为您服务
同时订购多样物品的源程序

This example was requested from one of our visitors where they wanted
to automatically create a PO of selected items from a list of
products from a database. The important thing about this example is
how to accurately capture the ID and Quantity of each item so you can
store it in the database correctly.

<!--#include virtual="/includes/openconnection.asp"-->

<%
If Request.Form.Count > 0 Then
  Set rsBook = Server.CreateObject("ADODB.Recordset")
  For I = 1 to Request.Form.Count
    Quantity = Trim(Request.Form.Item(I))
    If IsNumeric(Quantity) Then
      ASIN = Right(Request.Form.Key(I),Len(Request.Form.Key(I))-
4)
      'this example only displays the results back to the
browser
      'this is where you could write the Ordered Items to the
database
      'or create a PO.
      cmdTemp.CommandText = "SELECT ASIN, Title FROM Books
WHERE ASIN = '" & ASIN & "'"
      rsBook.Open cmdTemp, , 0, 1
      If NOT rsBook.EOF Then Response.Write Quantity & " - " &
rsBook("Title") & "
" & vbCRLF
      rsBook.Close
    End If
  Next
  Set rsBook = Nothing
  Response.End
End If
%>

<HTML>
<HEAD><TITLE>Ordering Multiple Products as the Same
Time</TITLE></HEAD>
<BODY>

<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>"
method=post>
<table>
  <tr>
    <th>Quantity</th>
    <th>Title</th>
  </tr>
  <%
  Set rsBooks = Server.CreateObject("ADODB.Recordset")
  cmdTemp.CommandText = "SELECT TOP 20 ASIN, Title FROM Books ORDER
BY PublicationDate DESC"
  rsBooks.Open cmdTemp, , 0, 1
  Do Until rsBooks.EOF
    %>
    <tr>
      <td><input type=text size=2 name=Book<%= rsBooks("ASIN")%
>></td>
      <td><%= rsBooks("Title") %></td>
    </tr>
    <%
    rsBooks.Movenext
  Loop
  rsBooks.Close
  Set rsBooks = Nothing
  %>
</table>
<p>
<input type=submit value="Checkout">
</form>

</BODY>
</HTML>

<!--#include virtual="/includes/closeconnection.asp"--> 


  2002年1月9日  阅读 1218 次  发送此页给朋友  来源:    版权争议  删除

相关文章:   近期热点:
§制作购物车程序!
§建立一个小型的购物车程序

上一篇: ASP商场源程序
下一篇: 制作购物车程序!
返回上一层...
搜索:

(C)2004-2022 7i24.Com 保留所有权利