Board index » delphi » D5 and Visual dBASE 5.5: select count(*)

D5 and Visual dBASE 5.5: select count(*)

Hi,

In a Delphi 5 application I use a TQuery-object to find
the number of records in a Visual dBASE 5.5 table.

The values of the relevant properties are:
    DatabaseName    C:\
    SQL                         select count (*)  from  test.dbf

When I try to set the Active-property to True, I  always get this
error-message:
    "Invalid file name"

In one of the test-sessions I made a typo in the SQL-property,
and typed "tst.dbf"  instead of  "test.dbf".

Much to my surprise, I got this mesage:
    "Table does not exist.
      File or directory does not exist.
      File: c:\tst.dbf "

So, Delphi recognizes the directory ("C:\") and the file-name ("tst.dbf") !!!

Now, why do I get the "Invalid file name"-message when I use the
correct file-name "test.dbf" ?

Thanks in advance,

============================================================

"Live Long and Prosper" - Spock
"And let Wisdom be your Guide" - Spock's brother

Ruud Schmeitz
Universiteit Maastricht

 

Re:D5 and Visual dBASE 5.5: select count(*)


The table name should be between quotes, e.g.:

select count(*)  from 'test.dbf'

(test is probably a restricted word)

"Ruud Schmeitz" <R.Schme...@MEMIC.UNIMAAS.NL> schreef in bericht
news:8hr0d6$ftf$1@rl0001.unimaas.nl...

Quote
> Hi,

> In a Delphi 5 application I use a TQuery-object to find
> the number of records in a Visual dBASE 5.5 table.

> The values of the relevant properties are:
>     DatabaseName    C:\
>     SQL                         select count (*)  from  test.dbf

> When I try to set the Active-property to True, I  always get this
> error-message:
>     "Invalid file name"

> In one of the test-sessions I made a typo in the SQL-property,
> and typed "tst.dbf"  instead of  "test.dbf".

> Much to my surprise, I got this mesage:
>     "Table does not exist.
>       File or directory does not exist.
>       File: c:\tst.dbf "

> So, Delphi recognizes the directory ("C:\") and the file-name ("tst.dbf")
!!!

> Now, why do I get the "Invalid file name"-message when I use the
> correct file-name "test.dbf" ?

> Thanks in advance,

> ============================================================

> "Live Long and Prosper" - Spock
> "And let Wisdom be your Guide" - Spock's brother

> Ruud Schmeitz
> Universiteit Maastricht

Re:D5 and Visual dBASE 5.5: select count(*)


Quote
>> In a Delphi 5 application I use a TQuery-object to find
>> the number of records in a Visual dBASE 5.5 table.

>> The values of the relevant properties are:
>>     DatabaseName    C:\
>>     SQL                         select count (*)  from  test.dbf

>> When I try to set the Active-property to True, I  always get this
>> error-message:
>>     "Invalid file name"

>> In one of the test-sessions I made a typo in the SQL-property,
>> and typed "tst.dbf"  instead of  "test.dbf".

>> Much to my surprise, I got this mesage:
>>     "Table does not exist.
>>       File or directory does not exist.
>>       File: c:\tst.dbf "

>> So, Delphi recognizes the directory ("C:\") and the file-name ("tst.dbf")
>!!!
>> Now, why do I get the "Invalid file name"-message when I use the
>> correct file-name "test.dbf" ?
M.H. Avegaart wrote in message <8hr1su$g...@porthos.nl.uu.net>...
>The table name should be between quotes, e.g.:

>select count(*)  from 'test.dbf'

>(test is probably a restricted word)

Thanks for your reply.

I've tried that (and numerous other possibilities), but it doesn't make
any difference: I still got the dreadful:
     "Invalid file name"

============================================================

"Live Long and Prosper" - Spock
"And let Wisdom be your Guide" - Spock's brother

Ruud Schmeitz
Universiteit Maastricht

Other Threads