|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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'. |
|
#2
|
||||
|
||||
|
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).
|
|
#3
|
|||
|
|||
|
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) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Help with SQL Statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|