I have a good understanding of this one, but no solution.
Code:
<script language="vbscript" runat="server">
CustID=Request.QueryString("CustID")
ProdID=Request.QueryString("ProdID")
OrderID=Request.QueryString("OrderID")
Qty=Request.QueryString("Qty")
Desc=Request.QueryString("Desc")
Per=Request.QueryString("Per")
Shp=Request.QueryString("Shp")
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; "& "Data Source=" & Server.MapPath("/Data/Orders.mdb")
Set OrderData=Server.CreateObject("ADODB.RecordSet")
OrderData.CursorType = 3
OrderData.CursorLocation = 3
OrderData.ActiveConnection = conn
OrderData.Open("Select OrderID From Orders where CustomerID='"+CustID+"'")
If OrderData.EOF then
OrderData.Close
SQL = "Insert Into Orders (CustomerID) Values('"+CustID+"')"
conn.Execute SQL
OrderData.Open("Select OrderID From Orders where CustomerID='"+CustID+"'")
OrdID= OrderData.Fields("OrderID")
OrdID=cstr(OrdID)
OrderData.Close
Else
OrdID= OrderData.Fields("OrderID")
OrdID=cstr(OrdID)
Qty=cstr(Qty)
ProdID=cstr(ProdID)
Desc=cstr(Desc)
Per=cstr(Per)
Shp=cstr(Shp)
OrderData.Close
End If
SQL = "Insert Into Items (OrderID,Qty,ProductID,Desc,Per,Shp) Values('"+OrdID+"','"+Qty+"','"+ProdID+"','"+Desc+"','"+Per+"','"+Shp+"')"
conn.Execute SQL
Set conn=nothing
RespStr= "The item has been added to your cart! You will have an opportunity at check-out to modify your order if you wish."
Response.Write(RespStr)
</script>
Everything is fine up to the Per and Shp vars,
I had to convert everything to strings because even though they started out as strings, when passed by QueryString vb interprets the "numeric strings" as numbers (great deal of time on that one!) Per and Shp are Decimal values(actually represent currency) such as "1.99" and ".39". Even though they have been converted to strings they create a syntax error in the highlighted script. What am I to do now? Please note all the values excepting Desc are also numbers, just no decimals.
|