Board index » delphi » Deleting records from Paradox table

Deleting records from Paradox table

Hello,

I have an application that uses some databases (paradox). In one database
all data is received from datacollection terminals. The user can than
calculate 2 other databases out of the data from the first database. It is
also possible to edit the data in the first database manually. So it is
necessary to recalculate the other two tables when this is done. The
calculations are allways done on data from one date till an other date. What
I want to do is delete all records, which are inbetween the two dates, from
the calculated tables. To do this I set a filter on the TTable component
which is connected to the table. Then I use delete to delete the records as
long as there are records in the filter. This is a very slow method. Is
there a faster way to do it?

I use TDatabase and TTable to connect to my tables.

Thanks in Advance,

Jos Krieckaart

 

Re:Deleting records from Paradox table


If possible, you can have an index on the dates. You can then set a
range for the two dates. You then do this:

        with Table1 do begin
                first;
                while not eof do delete;
        end;

This is much faster than filters.

Steve F (Team B)

Re:Deleting records from Paradox table


Quote
>To do this I set a filter on the TTable component
>which is connected to the table. Then I use delete to delete the records as
>long as there are records in the filter. This is a very slow method. Is
>there a faster way to do it?

A delete query would probably be faster

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Deleting records from Paradox table


Quote
> If possible, you can have an index on the dates. You can then set a
> range for the two dates. You then do this:

> with Table1 do begin
> first;
> while not eof do delete;
> end;

> This is much faster than filters.

I have an index on the dates.
I thought that if there is an index on the fields, filter automatically uses
the index en "behaves like a range". I will try it with a "real" range.

Thanks,

Jos Krieckaart

Re:Deleting records from Paradox table


Quote
> >To do this I set a filter on the TTable component
> >which is connected to the table. Then I use delete to delete the records
as
> >long as there are records in the filter. This is a very slow method. Is
> >there a faster way to do it?

> A delete query would probably be faster

What do you mean with a delete query? How do I implement it?

Thanks in advance,

Jos Krieckaart

Re:Deleting records from Paradox table


Quote
>What do you mean with a delete query? How do I implement it?

An SQL delete query
example

Delete from Yourtable
Where DateField Between '11/24/1999' and '11/26/1999'

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads