ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
  #1  
Old October 30th, 2003, 10:22 PM
craigg3 craigg3 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Beaumont, Tx
Posts: 20 craigg3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 14 sec
Reputation Power: 0
Help with SQL Statement

Can someone please help me out with this SQL Statement. Cant get it to work.

sqlAutoLookup = "SELECT * From Autos " _
&"WHERE Category LIKE '%" & Request("selCategory1") & "%' " _
&"AND [Type] LIKE '%" & Request("selType") & "%' " _
&"AND [AutoApproved] LIKE '%" & Request("txtApproved") & "%' " _
&"AND ItemName LIKE '%" & ItemName & "%' " _
&"AND Description LIKE '%" & ItemDesc & "%' " _
&"AND [Year] BETWEEN " & Request("selYearFrom") & " AND " & Request("selYearTo") _
&"AND AskingPrice BETWEEN " & Request("selPriceFrom") & " AND " & Request("selPriceTo") _
&"AND DatePlaced BETWEEN " & Request("txtFromDate") & " AND " & Request("txtToDate") _
&"ORDER BY [DatePlaced] DESC;"


This is the error I get:

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Category LIKE '%%' AND [Type] LIKE '%%' AND [AutoApproved] LIKE '%2%' AND ItemName LIKE '%%' AND Description LIKE '%%' AND [Year] BETWEEN 1800 AND 2004 AND AskingPrice BETWEEN 0 AND 1000000 AND DatePlaced BETWEEN 10/30/2003 10:12:34 PM AND 11/9/2003 10:12:3'.

Reply With Quote
  #2  
Old October 30th, 2003, 10:32 PM
roninblade's Avatar
roninblade roninblade is offline
// no comment
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Dec 2001
Posts: 1,639 roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level)roninblade User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 4 h 45 m
Reputation Power: 33
read your error message the answer is staring you in the face. check the variables you're passing. try using Request.Form.Item(yourVar) or Request.QueryString.Item(yourVar) (depends on how you're passing your variables) instead of just Request.(yourVar).

Reply With Quote
  #3  
Old October 30th, 2003, 11:06 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 5
its' good to learn from mistakes, craigg3.
__________________
Hope this helps.

Mike
Royal Selangor Pewter

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Help with SQL Statement


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