Why do I get a "Command is missing a required clause" error?

Posted on 2003-03-04
Medium Priority
Last Modified: 2010-04-04
In Delphi 6 I have an ADO connection to a Visual Foxpro table that I can open and add records to with no problem.  I am attempting to query the table with the sql statement:

SELECT ALL sProjSpec, cModName, dCheckIn;
FROM History;
WHERE !lProject;
ORDER by sProjSpec, cModName;
GROUP by sProjSpec, cModName

in a TADOQuery object.  I get the message "[Microsoft][ODBC Visual Foxpro Drive]Command is missing a required clause." when I attempt to make it active.  From the command window in Visual Foxpro 6 that command works fine.  I'm scratching my head here.  There is no required clause missing as far as I can see.  Help!  
Question by:sjburrows
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
LVL 17

Accepted Solution

geobul earned 200 total points
ID: 8065100

Remove ';' character at the end of the lines. It's used as SQL Statement terminator (end of the current statement).

Regards, Geo

Expert Comment

ID: 8065120
I've never used Foxpro, so perhaps I'm talking rubbish, but why let a little ignorance get in the way?

SELECT ALL sProjSpec, cModName, dCheckIn;
FROM History;
WHERE !lProject;
ORDER by sProjSpec, cModName;
GROUP by sProjSpec, cModName

Does the SQL really have those semi-colons there? Try taking them off.

  WHERE !lProject;
I would expect to see a condition on this. Is this a boolean field and the ! means not? If yes, try replacing it with
  WHERE lProject = false


Author Comment

ID: 8065412
In Visual Foxpro the ';' char is a line continuation char and is required for multi-line commands so I would expect that the ODBC Visual Foxpro driver would expect them as well.  But I just removed them and it worked to my surprise.  Geobul you led me down the right path first so I'm accepting your answer.  SimesA thanks as well.  FYI the '!' means NOT.  The condition "!lProject" means "not lProject" or False.

Thanks to both of you.


Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
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 …
Suggested Courses

770 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