• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 339
  • Last Modified:

Opening a DBF file

I need "detailed" instructions on how to open a dbf file in delphi, and display its contents in a TDBgrid.
I know how to drop a component on a form (TDBGrid, etc), so you can leave that part out. Im talking about the database access & controls compoennts I will need, and the properties to set.

I would like to do this away from the BDE if possible.

IELite
0
IElite
Asked:
IElite
  • 2
  • 2
1 Solution
 
BlackTigerXCommented:
ok, here's one *easy* way

1) run the ODBC Data Source Administrator
  - from the Start, Run type: odbcad32

2) Click Add, select Microsoft Visual Foxpro Driver, click Finish
3) type a name for your data source, select "Free Table Directory", type the path where you DBF file is, click ok

now in Delphi:
4) drop a ADOConnection to your form, double click on it
5) select Microsoft OLE DB Provider for ODBC Drivers, click next
6) in the "Use data source Name" select the one you created in step 3 (if it doesn't show up, click refresh), click OK

7) drop a ADOTable, set the ADOConnection to ADOConnection1
8) drop a DataSource, set the DataSet to ADOTable1
9) drop a DBGrid, set the DataSource to DataSource1
10) set the ADOTable Active to True

done. fiuf...

this was assuming the DBF was a Foxpro table... if is different, you just need to select the right driver in step 2
0
 
IEliteAuthor Commented:
Worked like a charm!

IELite
0
 
BlackTigerXCommented:
great... now, keep in mind that if you want this program to work in other machines, you'll have to do steps 1-3 in that machine... you probably already know that, but just mentioning... now... there's a way to do that programmatically... but that's another question =o)

best regards
0
 
IEliteAuthor Commented:
Nope - I just wanted to open it and see what was in there -------- I didn't have any thing to view the contents.....

thanks!

IElite
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now