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

Re: Type Mismatch woes! by Yan

Yan
Thu May 06 03:32:11 CDT 2004

Hi,

If you want to concatenate numeric data into a string variable, you will
have to convert them using the CStr() function.

Yan.

Tom Jordan wrote:
> 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



Re: Type Mismatch woes! by Dominique

Dominique
Thu May 06 17:38:55 CDT 2004

best to cast those variables. either strings or integers. casting as int
might round them up, and mess with ur totals tho' not sure... too lazy to
test right now :o)


"Tom Jordan" <tom@jb-solutions.co.uk> wrote in message
news:7f70719d.0405052250.f074f65@posting.google.com...
> 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