Hi all,
I've thrown together a simple shoppng cart and basket, but I
occasionally get a type mismatch error on the basket. For example:
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: "2.501.00"]'
There doesn't seem to be any pattern to it and I can't figure it out
at all, I was hoping someone could help!
My code:
<%
dim customerid
dim price
dim shipping
dim grandtotal
grandtotal = 0
shipping = 0
price = 0
customerid = session("id")
if customerid = "" THEN
Response.write "Your basket is empty"
Response.write "<br>"
Else
Set conn = Server.CreateObject("ADODB.Connection")
connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("data/data.mdb")
Conn.Open connStr
Set Session("myConn") = conn
strSQLQuery = "SELECT * FROM basket WHERE Customerid = '" & customerid
& "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strSQLQuery, conn, 3, 3
do until rs.eof
price = 0
price = rs("price") + rs("shipping")
price = price * rs("qty")
%>
<tr>
<td width="47%""><%=rs("title1")%>
</td>
<td width="11%"><%=rs("Qty")%>
</td>
<td width="8%">£<%=rs("price")%> </td>
</tr>
<%
grandtotal = grandtotal + total
shipping = shipping + rs("shipping")
rs.movenext
loop
rs.Filter = 0
conn.close
Set conn = Nothing
grandtotal = round(grandtotal,2)
%>
Many thanks!
Tom