Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting records within a paradox table???

Status
Not open for further replies.

JasonDBurke

Programmer
Jun 20, 2001
54
US
Hi,
I'm using Paradox tables to hold my Records. I want to sort these records based on information in different columns. HOW DO I GO ABOUT DOING THIS? WHAT ARE THE STEPS??? I have NO knowledge of SQL. Also, if this can be done what sorting algorithm does Delphi 5 use? If you know how to do this please help and send examples if you have them to jasondburke@yahoo.com :).

THANK YOU!!
 
If you're wanting to avoid using SQL then an alternate way of ordering data is to use secondary indexes created against the Paradox tables. You can then use Delphi code to indicate the index name you wich to use for the TTable components. This works fine but be warned that the Paradox tables can become corrupt unless the TTable components are closed correctly - may find yourself presented with 'Corrupt Header file...' or 'Index is out of date...' messages.
Hope this helps.
Steve
 
Use a TQuery object instead of a TTable
Set the SQL to:
SELECT * FROM <tablename> ORDER BY <column1,column2>
Set RequestLive to True

Requestlive allows you to edit the query as though it were a TTable. For RequestLive to work you must have an index on the paradox table that has exactly the same columns as your ORDER BY clause.
 
A way to learn SQL is using the Database Desktop which comes with Delphi.
It needs some experimenting.

Query your paradox tables using the Query by Example Method with the Database desktop. If the result is what you want, Select Query from the menu bar, Select Show Sql, this will show you the sql commands for the query.

Now referring to the post of TealWren, cut and paste from the desktop, to the sql property of the Tquery.

If you have the enterprise version of Delphi, you could work with the sql builder.

Hope this helps S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top