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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing multiple DBF files in VB

Status
Not open for further replies.

kevenl

Programmer
Joined
Jan 11, 2003
Messages
2
Location
US
I am working on a VB project that requires access to multiple DBF files (actually, they are Clipper files with using a CDX index). What is the best way to access files like this in VB? (I currently just need to read the data files, but later may need to update them also... because of their unique index structure, I've found this may be a problem)

I've considered creating ODBC connections, but this seems unfeasible to me since I am access dbf files across multiple directories -- each directory containing the databases for a single client -- and the program will need to access, for example, order.dbf, from any of these directories, and the program needs to be flexible enough to allow the user to select which client to use as the data source. Since I have no way of knowing in advance all the different client directories, I don't see ODBC as a good option.

Does anyone know of any good ActiveX controls or VB classes for manipulating dbf files?
 

You can use the "Microsoft Visual Fox Pro Driver" to access *.dbf files from fox pro, dBase and dBase type files. When you create your DSN select the "Free Table Directory" and then click on the options button. Make sure that the Null check box is checked, the Deleted Check box is NOT checked and the Fetch Data In Background is checked. You do not have to specify a directory structure at this time as you can do this dynamically in code.

Now once you have this set up you can access DBF tables in any directory you specify in code. You could allow the user to use the common dialog show open if you wanted.

Now, there are 3 methods that you can use to access this data. ADO, RDO, and DAO ODBC Direct. ADO is recommended but I preffer DAO ODBC Direct expecially when accessing large text fields. Why is this you ask? Well because with ADO you have to use the GetChunk method and with DAO you don't. Ok, Call me lazy because I don't want to do extra code but hey I'll be done faster. Productivity!

I Hope This Helps, Good Luck

 
Hi,
Can u please tell me how to open CDX index files with the dbf file. so that i dont have to worry about indexing.

regards
John Philip *** Even the Best, did the Bad and Made the Best ***

John Philip
Software Programmer
JustDial Services, Mumbai
johnphilip@justdial.com
 

jshanoo,

It would be better if you started a thread of your own.

kevenl,

Did that help any?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top