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

db4 Index Question 1

Status
Not open for further replies.

maddytk

Programmer
Jan 22, 2003
2
0
0
US
Am trying to deal w/ a VB app that uses a db4 database. A listbox is being filled with records from a table based on an Index - I can open the Index and see certain fields from the table and that it contains the records that populate the Listbox, but don't understand how these records get into this Index. I've never used db4 before. thanks for any help.
-Brian
 
Here's a rough explanation... a DBF index is much like an index in a book. It doesn't really contain the data but rather points to the database record, and fields, that do, giving the user the impression that the table is ordered in a certain way. Without the index, the table will be ordered in the way that the data was entered into it. There's always a better way...
 
There are 2 kinds of index files used with dBASE IV. The .ndx and the .mdx types. The .mdx is known as a production tag and has all the indices for a given database (.dbf) file while the .ndx has only a single index per .ndx file.

However, your issue about using these index files outside of dBASE is really different. When you USE a dBASE database file in dBASE, dBASE opens the database file (.dbf) and if there is a production index (.mdx) with the same filename, it will open and maintain that index as the database is updated. The .dbf file itself contains all the data, while the .mdx or .ndx files only have the sorted order info for dBASE to use when the data is used in a sorted order. A dBASE programmer would never do anything to an index file except program which fields he needs sorted and in which order -- dBASE handles this all internally.

I hope this is a start. If you need more, let me know.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top