Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Read DBase, Paradox, and Excel Files using FireDac



Permlink Replies: 8 - Last Post: May 7, 2017 9:33 PM Last Post By: Dmitry Arefiev
Bob Carson

Posts: 62
Registered: 10/8/04
Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 18, 2015 5:36 PM
Can someone direct me to any samples or articles on how to use the ODBC Physical Link in FireDac to access DBase, Paradox or Excel files? Thank you for any links to information. I can easily open and display Interbase, DBExpress, DataSnap, and Access files using FireDac.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 19, 2015 6:29 AM   in response to: Bob Carson in response to: Bob Carson
1) In general to configure ODBC connection:
* Drop TFDConnection
* Double click it
* Set "Driver ID" to ODBC
* Set "ODBCDriver" to required driver
* Press "Wizard" button
* Configure ODBC data source
* Press OK
In most cases you will get parameters to connect and use ODBC data source.
Note, that in most cases ODBCAdvanced will contain more parameters than required.

2) To work with DBF tables through FireDAC ODBC bridge driver, you can use parameters:
FDConnection1.Params.Clear;
FDConnection1.Params.Add('DriverID=ODBC');
FDConnection1.Params.Add('ODBCDriver={Microsoft dBase Driver (*.dbf)}');
FDConnection1.Params.Add('Database=<your path to DBF files>');
FDConnection1.Connected := True;
 
FDQuery1.Open('select * from mytable');

But I will strongly suggest to use FireDAC Advanced database driver to work with DBF files.

3) Excel:
FDConnection1.Params.Clear;
FDConnection1.Params.Add('DriverID=ODBC');
FDConnection1.Params.Add('ODBCDriver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}');
FDConnection1.Params.Add('Database=<your path to Excel file>\mybook.xls');
FDConnection1.Connected := True;
 
FDQuery1.Open('select * from `Sheet1$`');


--
With best regards,
Dmitry Arefiev / FireDAC Architect

Edited by: Dmitry Arefiev on Sep 19, 2015 10:17 PM
Bob Carson

Posts: 62
Registered: 10/8/04
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 19, 2015 11:09 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Thanks ! That worked !
Dave Fobare

Posts: 4
Registered: 6/14/02
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 5, 2017 2:52 PM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
I can use my XE8 to access dBase locally via FireDAC/ODBC dynamically (setting DriverID & Database) just fine. But deploying this has been a nightmare. I think I need to set ODBCAdvanced to something, but cannot figure out what.

Cary Jensen's otherwise very good "No App Is An Island" webinar covers this value for Paradox tables, but not dBase.

Help? I've distributed the necessary bpl's to the target machine and nothing is working.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 5, 2017 9:58 PM   in response to: Dave Fobare in response to: Dave Fobare
Help? I've distributed the necessary bpl's to the target machine and nothing is working.

What means "nothing is working" ? Any error message or misbehavior ?

--
With best regards,
Dmitry
Dave Fobare

Posts: 4
Registered: 6/14/02
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 7, 2017 9:40 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
The moment I set "myDBFTable.Active:=True" I get an exception along the lines of "driver not found".

Dmitry Arefiev wrote:
Help? I've distributed the necessary bpl's to the target machine and nothing is working.

What means "nothing is working" ? Any error message or misbehavior ?

--
With best regards,
Dmitry
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 7, 2017 9:33 PM   in response to: Dave Fobare in response to: Dave Fobare
The moment I set "myDBFTable.Active:=True" I get an exception along the lines of "driver not found".

And how is configured your TFDConnection ?
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/DBMS_Environment_Reports_(FireDAC)

--
With best regards,
Dmitry
quinn wildman

Posts: 856
Registered: 12/2/99
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 21, 2015 8:19 AM   in response to: Bob Carson in response to: Bob Carson
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Connect_to_ODBC_Data_Source_%28FireDAC%29

Bob Carson wrote:
Can someone direct me to any samples or articles on how to use the ODBC Physical Link in FireDac to access DBase, Paradox or Excel files? Thank you for any links to information. I can easily open and display Interbase, DBExpress, DataSnap, and Access files using FireDac.
Dave Fobare

Posts: 4
Registered: 6/14/02
Re: Read DBase, Paradox, and Excel Files using FireDac
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 5, 2017 2:53 PM   in response to: quinn wildman in response to: quinn wildman
No, there is not enough information there.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02