Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing of all dBase tables?

Status
Not open for further replies.

csteinhilber

Programmer
Aug 2, 2002
1,291
US
I'm trying to build a simple DB browser... and I'll like to know how I might be able to query a dBase datasource (via SQL, hopefully) to get a list of all it's tables.

Anyone?

TIA,
-Carl
 
Depends on what version of dBase the tables were created with. With the advent of dBaseIV, catalogs were available and some programmers even used them. (dBase III+ had a catalog system of sorts but I doubt that anybody used it much.) Otherwise, each table was a file unto itself. With that, you'll have to do one of two things:
1) figure out how to read the directory where the individual tables reside or 2) find the catalog for a database and read the contents of the catalog or 3) do both.

Good luck There's always a better way...
 
I assume you're using ODBC to connect to the dBase directory. You can get the directory where the files live from the DSN. Then use an OS utility to return all dbf files and populate a control with this list. Write your SQL statement to select from the file that the user has picked (just use a string variable to store it). A more powerful tool would be to bypass the ODBC and let the user pick a directory. Then, based on the directory, list all dbf files. Happy coding :)
BKtechie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top