Board index » delphi » index and sort Tables

index and sort Tables

I am using Delphi 2.0 and I wanted to order tables
(.dbf-files from dBase III+)
I How do I     1) index Table -primary and secondary-
                      2) sort Tables

Some help and a few hints would be great ...
some code would be fantastic...

Thanks a lot

Fran?ois

BTW: Happy 2000

 

Re:index and sort Tables


Fran?ois Lievens <fr.liev...@village.uunet.be> skrev i en
nyhedsmeddelelse:85a61p$i1...@newnews1.news.nl.uu.net...

Quote
> I am using Delphi 2.0 and I wanted to order tables
> (.dbf-files from dBase III+)
> I How do I     1) index Table -primary and secondary-

You can do it with a SQL statement.
I can't remember the syntax, but try to look in the help.

Quote
>                       2) sort Tables

You don't sort a table.
That's what indexes are for.

Finn Tolderlund

Re:index and sort Tables


On Sun, 9 Jan 2000 15:30:47 +0100, "Fran?ois Lievens"

Quote
<fr.liev...@village.uunet.be> wrote:
>I am using Delphi 2.0 and I wanted to order tables
>(.dbf-files from dBase III+)
>I How do I     1) index Table -primary and secondary-
>                      2) sort Tables

>Some help and a few hints would be great ...
>some code would be fantastic...

dBASE III PLUS used only non-maintained .NDX files. Support in Delphi for
these index types was not added until Delphi 4. So you cannot use/create
dBASE III PLUS indexes in Delphi 2. You could up the table version to at
least dBASE IV and thuse use index tags, but this would cause problems if
the table file needs to be dBASE III PLUS-compatible for external reasons.

You can retrieve data from a dBASE III PLUS table and display it in an
order other than natural order using a TQuery and SQL. The ORDER BY clause
determines the ordering. For example:

  SELECT L_Name, F_Name, City, State
  FROM "Addresses.dbf"
  ORDER BY State, L_Name, F_Name

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Other Threads