Board index » delphi » Index corruption on dBase tables

Index corruption on dBase tables

I'm really stuck on a problem in my Delphi 2.0 app.  I have version
4.5.1.4 of the BDE.  Here is what's happening:

I am using 4 temporary tables in a Quick Report.  Each table only has 2
fields - store number & sales.  The store number field is the key of the
production index tag (mdx file) of the temp file.  Before I call the
QuickReport I set up the data in the tables.  For each table I set
exclusive to true and do an emptytable.  Then I set up a query on
another data table, open that query and copy the results to the temp
table using a batch move copy.  I then run through another table (call
it table B) which has more store data.  For each record in table B, I
look up the corresponding store number in my temp table and add the
sales from table B to the sales in the temp table.  I then close the
temp table and change its Mastersource and Masterfields property to make
it a child table to another query (which is the main data table for the
report).  After doing this on all four temp tables, I run the
QuickReport.  The report runs fine.  (The Sales field from each of the
temp tables supplies the data for one column of the report.)

I can successfully run this report about 4 times in succession.  On
about the 4th time I run the report (but it's not always the 4th time),
the program blows up on an access violation when it tries to empty the
table.  When I go into Visual dBase and try to open the tables, it will
tell me that one of the tables has a missing or corrupt production index
file.  It appears to be random as to which of the four tables has the
corrupt index.  I recreate the index in Visual dBase and then I can
rerun the program again, and it runs fine for about 4 times.  Then the
same problem occurs.

I anyone has any idea about what might be causing this problem, I would
REALLY appreciate it.

Thanks,
Ann Haller

 

Re:Index corruption on dBase tables


Quote
Ann Haller wrote:

> I can successfully run this report about 4 times in succession.  On
> about the 4th time I run the report (but it's not always the 4th time),
> the program blows up on an access violation when it tries to empty the
> table.  When I go into Visual dBase and try to open the tables, it will
> tell me that one of the tables has a missing or corrupt production index
> file.  It appears to be random as to which of the four tables has the
> corrupt index.

No clear hints, just some suggestions how to possibly try to debug
that.

 - Try to Close all the tables AND your TDatabase component before
   each of those four runs.

 - Instead of Emptytable, try to clear your tables with loop,
     Table.First;
     While not Table.EOF... Delete
     Table.Next
 - If these bring no help, then perhaps the next step would be to try
   to drop and recreate those messing indexes on every run..

   Markku Nevalainen

Re:Index corruption on dBase tables


Thanks for your reply.  I upgraded to BDE 5 and the problem went away.  As I
suspected, I think it was a bug in the BDE.

Ann

Other Threads