|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Syntax error (missing operator) in query expression 'ID='
Hey all
First time poster here but I've spent a while lurking and reading the great threads here ![]() I've got a problem that I've wrapped my head around for a few days and I can't seem to figure it out. Im using ASP with Access 2000 DB. I want to perform a simple lookup by ID (AutoNumber in Access) and it says I am missing an operator. Code:
Do While count < eventCount
count = count + 1
'lookupID = Request.Form("e" & count & "_id")
qSQL = "SELECT * FROM tblCalendarItems WHERE ID= " & Request.Form("e" & count & "_id")
'Response.Write qSQL
'Response.End
This outputs - SELECT * FROM tblCalendarItems WHERE ID= 662206 I've also tried : qSQL = "SELECT * FROM tblCalendarItems WHERE ID= " & Request.Form("e" & count & "_id") & ";" Which outputs : SELECT * FROM tblCalendarItems WHERE ID= 662206; Which appears to be fine - any suggestions? |
|
#2
|
|||
|
|||
|
Not sure, but try this syntax
qSQL = "SELECT * FROM tblCalendarItems WHERE ID= '" & Request.Form("e" & count & "_id") & "'" I don't think it will make any difference but just looking at the syntax that is the only other I idea I could think of. lwells |
|
#3
|
|||
|
|||
|
Thanks for the tip
But unfortunately since the number i am passing in is Numeric, passing it in as a string value will not work ![]() I think I am going to open up the DB and perform the query in Access, and see what I can get there. |
|
#4
|
|||
|
|||
|
Yeah, I suspected that, but thought I would take a chance. The Request.Form("e" & count & "_id") is the culprit though, so maybe you can make this a variable and then pass it into your sql. But your idea of creating a query and then checking the syntax of the sql is probably the best approach.
Let us know what the actual sql will look like when you get it figured out. I am interested. lwells |
|
#5
|
|||
|
|||
|
I forgot to post here before I left work yesterday
![]() I figured out the problem and it had nothing to do with actual statement (seeing as how I put that exact SQL statement into Access and it performed correctly) but rather to do with the Do While Loop. eventCount was using Request.Form("event_count") which looked like a number, but was actually a string. So it was trying to go Do While count (integer) < eventCount (string) and basically timed out my script with useless loops ![]() I got the problem fixed and its running perfectly now Thanks for putting me in the right direction though ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Syntax error (missing operator) in query expression 'ID=' |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|