Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Trouble Accessing FoxPro table
Hi, here is my situation. There is a FoxPro file that is treated as a single table, within a directory f:
tdata. I have created an SQL component sqlGetUsers, given it a database name of f:
tdata, and a table name of SECURITY (corresponding to the file SECURITY.DBF). I need to match against two fields in SECURITY, User_Name and Password. The SQL I create looks like this:
"SELECT * FROM SECURITY WHERE User_Name = 'RUSTY' AND Password = 'RUSTY'"
There error I get back when I open this SQL is "Invalid use of reserved word 'Password' line 1". If I remove the Password portion of the statement, everything works fine.
So apparently, for the FoxPro driver that translates my Delphi created SQL statement, Password is a reserved word that cannot be used as a field. The only problem is, I have no control over the FoxPro tables/files themselves, they are public at the place I work, I can only retrieve information. I guess my question is, is there a different way to describe these fields in Delphi SQL? Is there any way to ask for, say, field 4 within the SQL statement itself?
I have tried this:
"SELECT * FROM SECURITY WHERE SECURITY.User_Name = 'RUSTY' AND SECURITY.Password = 'RUSTY'"
and this does not work. I have also used parameters like so:
"SELECT * FROM SECURITY WHERE User_Name = :UserName AND Password = :Password"
(and then have filled in the parameters before opening the SQL.)
This does not work either. Can anyone help here?
Any advice would be appreciated!
0 · ·