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.CreateOb ject("ADODB.Con nection")
connStr = "DRIVER={Micros oft 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.CreateOb ject("ADODB.Rec ordset")
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(grandtota l,2)
%>
Many thanks!
Tom 2 2978
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.CreateOb ject("ADODB.Con nection") connStr = "DRIVER={Micros oft 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.CreateOb ject("ADODB.Rec ordset") 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(grandtota l,2) %>
Many thanks!
Tom
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.goog le.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.CreateOb ject("ADODB.Con nection") connStr = "DRIVER={Micros oft 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.CreateOb ject("ADODB.Rec ordset") 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(grandtota l,2) %>
Many thanks!
Tom This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 the table datingnew the value of the ident field.
|
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 True. I then have an if statement to
determine what to write to the screen depending on blnNoData. As long as the
if statement is true (doesn't have to go to the else clause), the code runs
fine. Otherwise, a type mismatch error is returned. In...
|
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 verify the syntax, and that my .net code is ok - the type
mismatch is happening at: DataGrid1.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Thanks in advance,
|
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
have a page that allows users to type in the info (actually a calendar
pop-up allows me to make sure they do it in the correct format), into a
textbox.
When this page gets called up again, I want to prefill the box with the
existing data, in case...
|
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 14
(STDCOST).
---End Error Msg---
The STDCOST is set to decimal (28,14) and is a formatted in Access as a
number, single with 14 decimal. I don't know why I would be getting a Type
| |
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 347: 'response.Write(sql2)
|
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 an HTML file. When I execute
the EXE, which is only the form, and click the button, I get a "Type
Mismatch" error on this line in the form: mailobj.SaveOutlookMessage()
Any suggestions on why I'm getting the type mismatch error?
--Form code
|
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 class has stuff initialized by calling a sub SetClass that wants some
Word specific objects passed-in.
If the user mistakingly uses the wrong object, say, uses an Excel object
|
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 date is more than 10 months out.
The query runs fine, but I when I put the criteria of >10 I get 'Data Type mismatch' error. The code below is the original query. I have since put all the datediff bit in code, with all variables declared as date,...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |