Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 1st, 2004, 02:51 PM
ekaoxide ekaoxide is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 ekaoxide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #2  
Old November 1st, 2004, 04:50 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
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

Reply With Quote
  #3  
Old November 1st, 2004, 05:14 PM
ekaoxide ekaoxide is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 ekaoxide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old November 1st, 2004, 06:44 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
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

Reply With Quote
  #5  
Old November 2nd, 2004, 11:51 AM
ekaoxide ekaoxide is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 3 ekaoxide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb Fixed :d

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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Syntax error (missing operator) in query expression 'ID='


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 2 hosted by Hostway
Stay green...Green IT