Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2003, 10:20 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old June 23rd, 2003, 11:12 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Sydney, NSW, Australia.
Posts: 111
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Cheers
Ken

www.adOpenStatic.com
Reply With Quote
  #3 (permalink)  
Old June 24th, 2003, 06:11 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
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
Reply With Quote
  #4 (permalink)  
Old June 25th, 2003, 06:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
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"))
Reply With Quote
  #5 (permalink)  
Old June 25th, 2003, 07:23 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.