Board index » delphi » Delphi 3 can not open my FoxPro 2.6 *.dbf en *.cdx files

Delphi 3 can not open my FoxPro 2.6 *.dbf en *.cdx files

Hello world,

I have some trouble trying to open FoxPro *.dbf files and their index *.cdx
files.
When I create a new table in FoxPro 2.6 I have no trouble opening it with
Delphi 3.
I can add a memo field to it and define some indexes, this all works well.
A problem arises when I try to open one of the existing files in our
customer database which runs under FoxPro 2.6.
When I make Ttable active I get the message
Could not find language driver.
I have found a description of a *.dbf file header, the description was for
dBase III, dBase III plus, FoxBase and FoxPro files.
Unfortunately it describes only the first 16 bytes of it.
I found out that the codepage information is located at byte 30 and has the
following meanings: 01=437, 02=850, 03=1252 and 04=10000.
The files I couldnt open also had the value 01h in byte 29. By setting byte
29 to 00 I can open the file in Delphi.
I have no idea what the purpose is of that byte and I dont want to poke
bytes in an active FoxPro table file.
After I made it possible to open the *.dbf file I discovered a second
problem when I tried to open the index file, the same message occured:
Could not find language driver.
Although I also searched for the differences between the self made index
file and the one from the program.
I could not make it work.
I poked 00 at byte 11 and byte 12 this without any result.
Here below you see the contents of both files

Not possible to open in Delphi 3
--------------------------------
C:\Delphipj\db_test\customer.dbf
Structure of header first 32 bytes
F5 62 07 08 69 16 00 00 : 01 0A B5 02 00 00 00 00
00 00 00 00 00 00 00 00 : 00 00 00 00 01 03 00 00
Structure of Index first 16 bytes
00 04 00 00 00 00 00 00 : 00 00 04 8E 0A 00 E0 01

Possible to open in Delphi, but not the index file.
---------------------------------------------------
C:\Delphipj\db_test2\customer.dbf
Structure of header first 32 bytes
F5 62 07 08 69 16 00 00 : 01 0A B5 02 00 00 00 00
00 00 00 00 00 00 00 00 : 00 00 00 00 00 03 00 00
Structure of Index first 16 bytes
00 04 00 00 00 00 00 00 : 00 00 00 00 0A 00 E0 01

I would be pleased if someone out there could give me a solution for this
problem, without however modifying the structure of the original files.

Many thanks in advance,

Willy

 

Re:Delphi 3 can not open my FoxPro 2.6 *.dbf en *.cdx files


Willy Verbiest <willy.verbi...@village.uunet.be> wrote in article
<6oljq6$9...@forums.borland.com>...

Quote
> I have some trouble trying to open FoxPro *.dbf files and their index
*.cdx
> files.

Use the DBase driver after setting LEVEL=25 with the BDE config utility.
Byte 29 of a DBF file is set to 1 if the file has an associated
auto-maintained
index. It doesn't need to be set so long as you specify the indexfile
property of the
TTable components you use. If it is set, DBDesktop will take notice of it
and try to load the associated indexfile. However, DBD will assume the
index is named like the data file. If this is not the case, DBD will simply
ask if you want to detach the table from its index; detaching is equivalent
to setting byte 29 to 0.

You may also have some problems working with expression indexes (if you use
them), but there are a few work arounds, especially in D3 onwards.

regards,
Pete.  

Re:Delphi 3 can not open my FoxPro 2.6 *.dbf en *.cdx files


Hi Peter,

Thanks for your replay on my email.
I tested the settings you recommended, but without any result.
I still cant open the FoxPro files with the BDE without modifying them.
If you know the format of a FoxPro *.dbf header file and the *.cdx index
file I would be pleased to receive a description of it.

Kind regards,
Willy

Quote
Peter Lovelace wrote in message <01bdb165$3a6431a0$3eee3fcb@beta>...

>Willy Verbiest <willy.verbi...@village.uunet.be> wrote in article
><6oljq6$9...@forums.borland.com>...

>> I have some trouble trying to open FoxPro *.dbf files and their index
>*.cdx
>> files.

>Use the DBase driver after setting LEVEL=25 with the BDE config utility.
>Byte 29 of a DBF file is set to 1 if the file has an associated
>auto-maintained
>index. It doesn't need to be set so long as you specify the indexfile
>property of the
>TTable components you use. If it is set, DBDesktop will take notice of it
>and try to load the associated indexfile. However, DBD will assume the
>index is named like the data file. If this is not the case, DBD will simply
>ask if you want to detach the table from its index; detaching is equivalent
>to setting byte 29 to 0.

>You may also have some problems working with expression indexes (if you use
>them), but there are a few work arounds, especially in D3 onwards.

>regards,
>Pete.

Re:Delphi 3 can not open my FoxPro 2.6 *.dbf en *.cdx files


Therein likes the rub, I've been trying to figure out how to open up a Foxpro
table that has a different index (CDX) name then the tablename.  In this case,
byte 29 is set to 0 (non automaintained).  I've tried using DEBUG to set byte
29 to 1, and then tried the following code:

with TTable do begin
        DatabaseName := 'c:\datadir';
        Readonly := true;
        TableType := ttDBase;
        Tablename := 'costcntr.dbf';
        indexfiles.add('costc_i.cdx');
        indexname := 'costcenter';
        table1.open;
end;

and BDE still barfs with the message: "index does not exist: costcntr.mdx".  
Even setting LEVEL=25 in BDE, I can't use the TTable component to open up a
CDX file in this manner.  Do you have any suggestions?

Regards,
Mark

In article <01bdb165$3a6431a0$3eee3fcb@beta>, "Peter Lovelace"

Quote
<pet...@smart.net.au> wrote:

snip....
>Use the DBase driver after setting LEVEL=25 with the BDE config utility.
>Byte 29 of a DBF file is set to 1 if the file has an associated
>auto-maintained index. It doesn't need to be set so long as you specify the indexfile
>property of the TTable components you use. If it is set, DBDesktop will take notice of it
>and try to load the associated indexfile. However, DBD will assume the
>index is named like the data file. If this is not the case, DBD will simply
>ask if you want to detach the table from its index; detaching is equivalent
>to setting byte 29 to 0.

**  Remove ".nospam" when replying or email will bounce back to you...

Other Threads