<%@ Language=VBScript %> <% pageTitle = "Add To Cart" %> <% '****************************************************** 'Copyright©2000-2002 MetaLinks.com @ http://metalinks.com '****************************************************** Sub CreateNewOrder() Application.lock if Application("orderID") = "" then Application("orderID") = 1 end if intOrderID = Application("orderID") Session("orderID") = intOrderID Conn.Execute("INSERT INTO orders " _ & " (orderID, status) values " _ & " ("&intOrderID&", 'OPEN')") Application("orderID") = Application("orderID") + 1 Application.Unlock End Sub Sub AddToOrder(nOrderID, nProductID, nQuant) sqlText = "INSERT INTO itemsOrdered " _ & " (orderID, productID, quantity) values " _ & " ("&nOrderID&", "&nProductID&", "&nQuant&")" Conn.Execute(sqlText) End Sub 'Main program intProdID = Request.form("intProdID") intQuant = Request.form("intQuant") set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConString intOrderID = cstr(Session("orderID")) if intOrderID = "" then CreateNewOrder end if sqlText = "SELECT * FROM itemsOrdered WHERE orderID =" & intOrderID & "AND productID =" & intProdID set rsOrder = Conn.Execute(sqlText) if rsOrder.EOF then txtInfo = "This item has been added to your order." AddToOrder intOrderID, intProdID, intQuant else txtInfo = "This item is already in your cart." end if %> <%= pageTitle %>
 
  metalinks.com | Home | Customer Service | View Cart | Product Search

Live Demo

This store and its products are for demonstration purposes only. You cannot actually purchase any of the products, nor is there a secure server to process your order.



More info
Contact us

<%= txtInfo %>

Back  Review Order and/or Check Out

Continue Shopping.

<% Conn.Close set Conn = Nothing %>

Last Updated: Saturday, July 07, 2001
Powered by MetaCart, ©2000-2001 MetaLinks.com