PDA

View Full Version : Product Cart


sirvolt_98
10-07-2003, 05:04 AM
Can anyone please help me make this code explicit? I am using a DSN-less connection. I am still quite a newbie in web development. Any help will be greatly appreciated.


<%@ Language=VBScript %>

<% Dim CS, DRV, DBQ
DRV = "Driver={Microsoft Access Driver (*.mdb)};"
DBQ = "DBQ= " & Server.MapPath("WWTSDBase.mdb") & "; "
CS = DRV & DBQ
%>

<%
Dim RSCustomer
Dim RSOrder
Dim RSProduct
Dim OrderTotal

Set CS = Server.CreateObject("ADODB.Connection")

If IsEmpty (Session("CustomerID")) Then
CS.Execute "Insert into Customers (OrderDate) "_
& "Values ('" & Now & "')"
set Customers = CS.Execute("Select Max(CustomerID) "_
& "As MaxID From Customers")
Session("CustomerID") = Customer("MaxID")
End If

If (Request.Form("Submit")) Then
set RSProduct = CS.Execute("Select ProductName, Price, "_
& "Shipping From Product Where ProductID = "_
& Request.Form("ProductID"))
CS.Execute "Insert Into Order (CustomerID, ProductID, "_
& "ProductName, Quantity, ItemTotalPrice) Values (" _
& Session ("CustomerID") & ", " _
& Request.Form("ProductID") & ", " _
& "'" & RSProduct ("ProductName") & "', " _
& Request.Form("Quantity") & ", " _
& ((Request.Form("Quantity") * RSProduct("Price")) + _
(Request.Form("Quantity") * RSProduct("Shipping"))) & ")"
End If

If Not IsEmpty(Request.Querystring("RemoveID")) Then
CS.Execute "Delete From Order Where OrderID = " _
& Request.Querystring("RemoveID")
End If

Set RSOrderItem = CS.Execute("Select OrderID, ProductID, ProductName, " _
& "Quantity, ItemTotalPrice From Order Where CustomerID = " _
& Session("CustomerID"))
%>