PDA

Click to See Complete Forum and Search --> : Using dBase Files with VB6


Lou
Sep 13th, 1999, 12:01 AM
I am trying to write a visual basic program that will allow users to manually edit records from dbase tables in a DOS based legacy system. i have been able to connect to the tables using DAO, but have not been able to use the indexes. Any ideas on how to do this without having to use ODBC?

I have since tested this using dBase Indexes and have gotten it to work, but I need it to work with Clipper Index (NTX) files.

[This message has been edited by Lou (edited 09-14-1999).]

[This message has been edited by Lou (edited 09-14-1999).]

SmithVoice
Sep 14th, 1999, 10:51 PM
A Clipper user may be able to tell you how to use the Clipper support
utilites (I have seen them mentioned on the msnews.public.database.dao NG in the past and you can get them
from www.blinkinc.com) (http://www.blinkinc.com))

However, it is probably similar to forcing Jet to use the other xBase
indexes.

The following comes from pages 347-348 of the Waite Group's VisualBasic 4
Database How-to:

"There are 2 strategies you can use to associte index files with dbf files:

"1) Create a cdx or mdx file with the same name as the dbf file and place it
in the same directory as the data file. VB (DAO, the datacontrol does no
use these indexes) will automatically associate all the indexes in the
file with the dBase (xBase with dBase 4 or FoxPro compatibility) file.

"2) List indexes in a text file with the same name as the dbf file and the
extension *.inf. VB will automatically read the file when you open the table
and associate the indexes named in the file with your dbf file. If you are
using dBaseIII (or xBase with that compatibility) then this is the only
option.

"No matter which of these strategies you adopt, the index files must be in
the database directory named in teh argument to the opendatabase function.
The INF file must also be in the same directory, unless you specify a
different path for the file using the INFPath entry under the [dBase ISAM]
heading in your application's ini file.

"If you choose INF method, the INF file must be in a specific format.
Assume CUSTOMER.DBF is a dBaseIII compatible file and that you are using
four indexes, which are stored in the files CUSTNUM.NDX, NAME.NDX,
STATE.NDX, and ZIPCODE.NDX. CUSTLIST.INF would have 4 entries:

NDX1=CUSTNUM.NDX
NDX2=NAME.NDX
NDX3=STATE.NDX
NDX4=ZIPCODE.NDX

"For other index types, use the same method substituting the appropriate
fiel extension both before the equal sign and after the file name like :
MDX1=MYINDEX.MDX

"dBase and FoxPro (2.0->3.0, the xBase versions) both support unique indexes - indexes that filter out
duplicate index values - To specify a unique index, prefix the index
identifier to the INF file with the letter U such as: UNDX1=ZIPCODE.NDX"


The Clipper Utilities may make you most comfortable but since Clipper is
xBase (as is Codebase, Foxpro and dBase) you will probably find this
information useful.


pt 2:

Another thing to cosider for Clipper5 or earlier is that if you link NDX.OBJ
into your complied Clipper program you can get Cliper to use dBase NDXs (but
also means that Clippper will only use NCX and can't take advantage of the
native NTxes.

If you're using Clippper 5.1 oor higher use the DBFNDX relational database
driver.

This from page 44 of the old Access for Windows tips From Compute Books by
Tom Campbell.

I know that the text is relatively old, but xBase users have a tendancy to
stick with older formats for maintenance so I took the chance.

-Smith

------------------ http://www.smithvoice.com/vbfun.htm

[This message has been edited by SmithVoice (edited 09-15-1999).]

[This message has been edited by SmithVoice (edited 09-15-1999).]