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

Reading from dBase IV database 1

Status
Not open for further replies.

NewToDelphi

Programmer
Joined
Jun 30, 2003
Messages
2
Location
AU
I am a new user to Delphi and am trying to read from a dBase IV database. I am using Delphi 7. Can anyone tell me whether it's possible to do that and how I do it?

Thanks!
 
NewToDelphi,

Yes, it's possible. There are a number of ways to do it. Here's one:

1. Create a new form.

2. From the BDE tab, place a Table component on the form.

3. Select the Table component. Set DatabaseName to the directory containing the dBASE table and the TableName property to the table's filename, e.g. MyTABLE.DBF.

4. Set Active to true. If everything's OK, then the table is actually open.

5. From the Data Acess tab, p[lace a DataSource component on the form and connect it's Dataset property to Table1.

6. From the Data Controls tab, place a DBGrid on the form and then set its DataSource property to DataSource1.

Save and run your project. Season to taste.

Hope this helps...

-- Lance
 
Some minor details, open the BDE administrator and register your dbf files collection, with an alias.
After that they will be available to delphi without setting a path for every table.

Steven van Els
SAvanEls@cq-link.sr
 
Steven,

Not quite; you still have to set DatabaseName to the alias. Also, if you deploy an application using public aliases, you need to ensure that the alias is defined on your user's machine as well.

Personally, I prefer to create aliases when the application starts up (see for details). This gets away from having to muck about with the BDE administrator, the CFG file, or the Registry.

(Actually, I tend to use Database objects and assign the dataset objects to that. ;-))

Hope this helps...

-- Lance
 
The Database object is also my favourite, interesting site you indicated.

Steven van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top