473,407 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Type Mismatch woes!

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
Jul 19 '05 #1
2 2959
Yan
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

Jul 19 '05 #2
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" <to*@jb-solutions.co.uk> wrote in message
news:7f*************************@posting.google.co m...
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

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arun Wadhawan | last post by:
Hello MY SQL Server is causing me this problem : Microsoft VBScript runtime error '800a000d' Type mismatch: 'ident' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am getting from...
1
by: LJgrnl | last post by:
I've got a type mismatch error that's driving me nutty. Variable blnNoData has the initial value False. If a recordset comes back empty (both .EOF and ..BOF are true) then blnNoData is set to...
1
by: Mark | last post by:
Hi - I tried this in VS.Net, and also in the Web Matrix code below: - but I am getting a type mismatch error. The sql statement runs perfectly from within the Access Query Designer. Can anyone...
7
by: middletree | last post by:
I've been messing with this for hours, and have been to various sites, including Aaron's site, and am truly stumped. The short version: in SQL Server, the 4 fields in question are datetime. I...
4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
3
by: amitbadgi | last post by:
I am getting teh following error while converting an asp application to asp.net, Exception Details: System.Runtime.InteropServices.COMException: Type mismatch. Source Error: Line...
1
by: Brett | last post by:
I have a form that calls a method within a DLL. By clicking a button on the form, the DLL is instantiated and the SaveOutlookMessage() method invoked. The DLL code copies messages from Outlook to...
6
by: Howard Kaikow | last post by:
I'm doing a VB 6 project in which I am trying to protect against type mismatch errors. Is the process any different in VB .NET? Here's what I'm doing in VB 6. I have an ActiveX DLL. The...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.