Wiki Home

Adding Tables To Foxpro Database


Namespace: Wiki
I have multiple DBF files.
Is there a way I can add all these to a foxpro database simultaneously?

Thanks :)

Try This...
tablepathC = "c:\yourapp\yourappdata\"
OPEN DATABASE yourdbc
FOR x = 1 TO ADIR(filesA, tablepathC + "*.DBF")
  TRY
    ADD TABLE (tablepathC + filesA[x, 1])
  CATCH to err
    * Comes here in case the table is already added to the database
    MESSAGEBOX(err.message)
  ENDTRY
ENDFOR


Corrected AFILES() to ADIR()--TamarGranor

You can also do it interactively. Open the database design window (MODIFY DATABASE). Multi-select the DBF files in Windows Explorer, and drag them into the design window. Mike Lewis
Ben Creighton
( Topic last updated: 2008.01.10 10:02:31 AM )