• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1382
  • Last Modified:

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

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!  
0
sjburrows
Asked:
sjburrows
1 Solution
 
geobulCommented:
Hi,

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

Regards, Geo
0
 
SimesACommented:
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


0
 
sjburrowsAuthor Commented:
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.

Scott
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now