SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 4th, 2004, 06:30 AM
tyroneclark tyroneclark is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 tyroneclark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Data type mismatch in criteria expression.

Hi.
I am trying to make a page where you can view orders which customers have placed, I have already made several of these pages, however they were viewing the customers and products. The problem ii have is that i have made a dynamic drop down box on the first page which has the name "make" and it has the action set to "res_1_orders_2.asp", which is the page i am having trouble with.
i have made a recordset which has a filter of "Request.Form("make"):

10 <%
11 Dim Recordset1
12 Dim Recordset1_numRows
13
14 Set Recordset1 = Server.CreateObject("ADODB.Recordset")
15 Recordset1.ActiveConnection = MM_fgh_STRING
16 Recordset1.Source = "SELECT * FROM Query WHERE Order_Date = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY Surname ASC"
17 Recordset1.CursorType = 0
18 Recordset1.CursorLocation = 2
19 Recordset1.LockType = 1
20 Recordset1.Open()
21 Recordset1_numRows = 0
22 %>


When I run the first page, selecting a date, and click "submit" the second page comes up, showing this:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/splatware/res_1_view_orders_2.asp, line 20


At the moment Line 20 is "Recordset1.Open()" I cant see a problem of this. Can someone help and tell me whats wrong with the recordset?

Thanks for any help, it is greately appreciated.

Tyrone

Reply With Quote
  #2  
Old March 4th, 2004, 09:10 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
It would appear that the SQL Statement (Dreamweaver generated?) is incorrect, when searching a date field in MS Access it requires (#) pound signs around the date like this
Code:
"SELECT * FROM Query WHERE Order_Date = #" & Recordset1__MMColParam & "# ORDER BY Surname ASC"

I would strongly suggest in the future that you write your own code and not rely on dreamweaver to write it for you, as it makes many mistakes and is not very efficient.

Reply With Quote
  #3  
Old March 4th, 2004, 09:56 AM
tyroneclark tyroneclark is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 tyroneclark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, but still a problem! :(

Hi again,
Thanks for that...but theres still a problem.
It doesn't come up with the error anymore, and the page loads. But now the drop down box doesnt list the customers that made an order on the date that you choose on the previous page, all the drop down box shows is ----------SELECT---------- which the default value is set to. I need it to take the input from the last drop down box, called "make" and show the customers that placed an order on that date.
For every date on the page before (res_1_view_orser.asp) there is definetly an order, because of the way that i have done the page. so there must always be a name on the following page (the one with the problem "res_1_view_oreders_2.asp")
This is what the recordset, including the request.form:

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.Form("make") <> "") Then
Recordset1__MMColParam = Request.Form("make")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_fgh_STRING
Recordset1.Source = "SELECT * FROM Query WHERE Order_Date = #" & Recordset1__MMColParam & "# ORDER BY Surname ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>


Can you help again

Thanks for alot

Tyrone

Reply With Quote
  #4  
Old March 4th, 2004, 10:09 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
You code doesn't look correct.
Code:
Recordset1__MMColParam = Request.Form("make")

Recordset1.Source = "SELECT * FROM Query WHERE Order_Date = #" & Recordset1__MMColParam & "# ORDER BY Surname ASC"

You query is try to return records where the Order_Date = the make selected on the form???

Wouldn't it be like this?
Code:
Recordset1__MMColParam = Request.Form("make")

Recordset1.Source = "SELECT * FROM Query WHERE Make = '" & Recordset1__MMColParam & "' ORDER BY Surname ASC"

Reply With Quote
  #5  
Old March 4th, 2004, 10:19 AM
tyroneclark tyroneclark is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 tyroneclark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OMG! Another problem.

I have inserted what u showed, but now there is a problem with the "Recordset1.Open()" bit of the rocordset. When i run the page there is an error, and it says this:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/splatware/res_1_view_orders_2.asp, line 20


Here is line 20:

<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_fgh_STRING
Recordset1.Source = "SELECT * FROM Query WHERE Make = '" & Recordset1__MMColParam & "' ORDER BY Surname ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>


I have looked, and can't find any sort of problem with this.

Thanks for your time

Tyrone

Reply With Quote
  #6  
Old April 1st, 2004, 05:02 PM
thekechi thekechi is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 thekechi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i have a similar problem

Hi guys my code is like this/weekly.asp?wd=05.04.2004&wdl=11.04.2004)
<%
dim mydatel
mydatel=cdate(request.querystring("wdl"))
%>
<%
dim mydate
mydate=cdate(request.querystring("wd"))
%>
<%
Dim rs_weekly
Dim rs_weekly_numRows
Set rs_weekly = Server.CreateObject("ADODB.Recordset")
rs_weekly.ActiveConnection = MM_conn_STRING
rs_weekly.Source = "SELECT * FROM reon_db_tbl1 WHERE a_date<='"&mydatel&"' AND a_datelast>='"&mydate&"'"
rs_weekly.CursorType = 0
rs_weekly.CursorLocation = 2
rs_weekly.LockType = 1
rs_weekly.Open()
rs_weekly_numRows = 0
%>

error message is like this:
Data type mismatch in criteria expression

in the database is access2000, cols a_date and a_datelast are formated as short date which refers to 10.02.2000 in my language (Turkish)
thanks for your interest.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Data type mismatch in criteria expression.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT