Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2003, 10:20 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Data Type Mismatch error

HELLLLLP!

I'm trying to build my own shopping cart code and I have problems getting this one piece of code to work due to the following error:

Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/OfficeCreations/basket.asp, line 128


Here is the portion of code that I cannot correct to get the query to work on.

<tr>
<td align="right" class="dropdown" COLSPAN="3" HEIGHT="25"> <b>SUBTOTAL:</b></td>

<% Call connect
    Dim rsLineTotal, sumTotal
    Set rsLineTotal = connection.Execute("SELECT Sum(lineItemTotal) AS sumTotal FROM SHOPPINGCART WHERE AccountID = '" & Session("AccountID") & "'")
%>

<td align="right" class="dropdown"><b><%=rsLineTotal("sumTotal")%> </b></td>
</tr>


The error is on line 128 where I Set rsLineTotal. "Connect" is the Sub where I establish the connection to the database FYI.

Please email me and I will try to accommodate anyone with additional explanation and/or code to get this working and get that error off my page.

Please and thank you.
 
Old June 23rd, 2003, 11:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://www.adopenstatic.com/faq/80040E07.asp

Cheers
Ken

www.adOpenStatic.com
 
Old June 24th, 2003, 06:11 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Perhaps somebody can help or suggest ways to correct the code, rather than link pages to their favorite web site.
Though Ken's reply was well intentioned, it does not suggest ways to fix the code.

Any more help is appreciated.


Quote:
quote:Originally posted by KenSchaefer
 http://www.adopenstatic.com/faq/80040E07.asp

Cheers
Ken

www.adOpenStatic.com
 
Old June 25th, 2003, 06:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

The link that Ken posted suggests that it's caused by your SQL statement. Since there is only one field in your where clause, have you tried changing it to remove the ' around the AccountID? If AccountID is numeric, you shouldn't surround it with '.

Just to be crystal clear, change it to this and see what happens:
Code:
Set rsLineTotal = connection.Execute("SELECT Sum(lineItemTotal) AS sumTotal FROM SHOPPINGCART WHERE AccountID = " & Session("AccountID"))
 
Old June 25th, 2003, 07:23 PM
Registered User
 
Join Date: Jun 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the clarity pgtips. It is working as I'd like it to.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Data type mismatch sharon5469 ASP.NET 1.0 and 1.1 Basics 2 May 27th, 2007 10:01 AM
error 3464 'data type mismatch in criteria express Vince_421 Access VBA 3 May 3rd, 2007 06:45 AM
Data Type Mismatch Error in Criteria Expression mmcdonal Access VBA 2 March 1st, 2007 05:18 PM
data type mismatch karma SQL Language 3 April 6th, 2006 07:58 AM
Data Type mismatch error clueless_may Access VBA 1 May 5th, 2004 09:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.