TQuery SQL EDBEngineError

Posted on 2002-03-05
Medium Priority
Last Modified: 2010-04-05
Hi Experts,

I tried to make a SQL application and I have got the EDBEngineError message: General SQL error [Microsoft][ODBC Microsoft Access Driver]Syntax error (missing operator) in query expression in query expression 'Country where country >= F'.'.
There is a DataModule with Query1: TQery and the SQL-phrase is :
Query1.SQL.Add('select * from Country order by COUNTRY where COUNTRY >= ' + EditBox1.Text;
Something interesting is the end of error phrase: quote - point - qoute
meikl told me to replace the


but the resulted error message was the same.

Could somebody give me a new idea? I try to give more points later but now I have only this ten.


Question by:kacor
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 27

Expert Comment

ID: 6841458
hi janos,

regarding to your last screenshot you sent me,
you've missed a bracket ) before the ;

query1.sql.add('select * from atable where afield >= '+ansiquotedstr(AString,'"'));

about your statement above the order by clause must be behind the where-clause

select ...FieldList
  from ...TableList
 where ...Conditions
 order by ...FieldList

meikl ;-)

LVL 27

Expert Comment

ID: 6841465
btw. you could also use parameters
instead of rebuild the sql-string allways.


Accepted Solution

jsweby earned 80 total points
ID: 6841925
The error is because the ORDER BY clause is before the WHERE clause. The best syntax for this operation is:

Query1.SQL.Append('SELECT * FROM Country WHERE Country >= :sCountry ORDER by COUNTRY');
Query1.ParamByName('sCountry').AsString :=EditBox1.Text;

This is assuming, of course, that Country is a text field in a table called Country.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 10

Author Comment

ID: 6847710
Hi, I had no internet connection til now

Tnx your help

tonight  i'll try to read the messages


LVL 10

Author Comment

ID: 6854185
Hi meikl and jsweby,

many thanks for helping me.


it works perfectly but first I forgot to insert : before the paramameter name :-))


something I make wrong but the offered solution don't work. Today I would like to have a good result using your offered solution because it interests me and the result will be submitted

LVL 10

Author Comment

ID: 6854186
Thanks jsweby


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month12 days, 23 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question