Board index » delphi » Select - Order By, What Am I Doing Wrong?

Select - Order By, What Am I Doing Wrong?

  I'm working with a FoxPro 2.6 table using the standard TDatasource,
TTable and TQuery components and when I attempt this Select statement;

     Select * From Emplstat Where (Emplnum = :Empnum) Order By
     TimeStamp

and set the Active property of the query to true I get the message
'Project X raised exception class EDBEngineError with message 'Invalid
use of keyword. Token: TIMESTAMP''. The message seems to indicate that
it's not aware that TimeStamp is one of the fields being returned, but
TimeStamp is one of the fields which I'm asking the select to return so
I'm not really sure what the problem is. Any idea's,

Thanks,
Chris LeFebvre

 

Re:Select - Order By, What Am I Doing Wrong?


TimeStamp is a Local SQL keyword.  If you can't rename the column in the DB
structure to something that is not a keyword try quoting the "TimeStamp" and see
if that helps.

Quote
Chris LeFebvre wrote:

>   I'm working with a FoxPro 2.6 table using the standard TDatasource,
> TTable and TQuery components and when I attempt this Select statement;

>      Select * From Emplstat Where (Emplnum = :Empnum) Order By
>      TimeStamp

> and set the Active property of the query to true I get the message
> 'Project X raised exception class EDBEngineError with message 'Invalid
> use of keyword. Token: TIMESTAMP''. The message seems to indicate that
> it's not aware that TimeStamp is one of the fields being returned, but
> TimeStamp is one of the fields which I'm asking the select to return so
> I'm not really sure what the problem is. Any idea's,

> Thanks,
> Chris LeFebvre

--
Jeff Overcash (TeamB)   On waves of silver I dreamed of gold
(Please do not email    'Till I lost the peace that dreaming gives
 me directly unless     I dreamed of the moment of my own death
 asked.  Thank You)     That no one ever dreams and lives (Marillion)

Re:Select - Order By, What Am I Doing Wrong?


Timestamp is one of the reserve word,

use following syntax

     Select * From "Emplstat.dbf" EmpStat Where (Emplnum = :Empnum) Order
By
     EmpStat."TimeStamp"

Quote
Chris LeFebvre wrote:
>   I'm working with a FoxPro 2.6 table using the standard TDatasource,
> TTable and TQuery components and when I attempt this Select statement;

>      Select * From Emplstat Where (Emplnum = :Empnum) Order By
>      TimeStamp

> and set the Active property of the query to true I get the message
> 'Project X raised exception class EDBEngineError with message 'Invalid
> use of keyword. Token: TIMESTAMP''. The message seems to indicate that
> it's not aware that TimeStamp is one of the fields being returned, but
> TimeStamp is one of the fields which I'm asking the select to return so
> I'm not really sure what the problem is. Any idea's,

> Thanks,
> Chris LeFebvre

Re:Select - Order By, What Am I Doing Wrong?


On Tue, 22 Feb 2000 00:19:20 +0530, Veeranna Ronad <vyron...@bol.net.in>
wrote:

Quote
>Timestamp is one of the reserve word,

>use following syntax

>     Select * From "Emplstat.dbf" EmpStat Where (Emplnum = :Empnum) Order
>By
>     EmpStat."TimeStamp"

I would point out that this is documented in the local SQL online help. In
the index, look for "naming conventions". In the "Conventions" topic, click
on the "Column names" jump.

Local SQL (the SQL implementation the BDE uses for dBASE, Paradox, and
FoxPro tables) is documented in the online help file LOCALSQL.HLP, found in
the main BDE directory. This help file is a language reference of the local
SQL implementation (subset) of SQL-92. The copy of this file that came with
BDE 4.x (and earlier versions) was seriously out of date and contained
little useful information. It has since been rewritten. It has been updated
again concurrent with C++Builder 5. Updated copies will have the topic
"VIEWs" in the index (and lack of this topic indicates a pre-update copy).
I can e-mail you a copy of the updated file if you need and desire it.

==========================================================================
Steve Koterski                      "Only dead fish swim with the stream."
Technical Publications                                          -- Unknown
Borland
http://www.borland.com/techpubs/delphi

Re:Select - Order By, What Am I Doing Wrong?


Steve,

Is the updated LOCALSQL.HLP available for downloading?

Bob
--

Using Virtual Access
http://www.vamail.com

Re:Select - Order By, What Am I Doing Wrong?


        Jeff:
  Unfortunately the table belongs to a third party app that's a compiled Foxpro 2.6
for Windows program from which I'm just exporting data so I have no control over the
field names. Adding the quotes didn't do the trick but Veeranna elaborated on this
subject in a followup message and I believe that may offer a solution. Thanks for
the help,

Regards,
Chris LeFebvre

Re:Select - Order By, What Am I Doing Wrong?


        Steve:
  My copy of LocalSql.Hlp is dated 01/12/99 which I gather is the "seriously
out of date" version, I checked Borlands site and I only see the last Help
updates for Delphi (dated 10/07/99) which I already have so I take it that this
file was not one of the ones included. I also checked the C++ Builder section
and didn't see this file available for download either, if it's not too much
trouble would you email me the updated help file.

Regards,
Chris LeFebvre

Re:Select - Order By, What Am I Doing Wrong?


On Wed, 23 Feb 2000 07:41:26 +0000, Bob Villiers <100522...@COMPUSERVE.COM>
wrote:

Quote
>Is the updated LOCALSQL.HLP available for downloading?

Soon, Grasshopper. Soon...

(With apologies to the old television show Kung Fu.)

==========================================================================
Steve Koterski                      "Only dead fish swim with the stream."
Technical Publications                                          -- Unknown
Borland
http://www.borland.com/techpubs/delphi

Other Threads