Re: Delphi: sorting records from a DBgrid

[ Delphi Forum -- by DelphiLand ]

Posted by webmaster Guido on December 05, 2003 at 18:21:53:

In Reply to: sorting record from a DBgrid posted by martin -12330 on November 29, 2003 at 21:30:06:

: 1.what coding procdure will i write to sort record say in a database of students where i want only female students from only the display records form the dbgrid and not from the table.
: 2.still on the student database what coding procdure will i write to retrieve the various marks obtained in various subjects entered on a different form for a particular student.

1. The first step would be the filtering of the records, leaving you with only female students AND also in the grid, if I understand you well.
Say, you copy them to a temporary table.

Next, you don't have to write any code to "sort" the records, Delphi does this for you if you either "index" this second table, or if you use a TQuery component with the necessary SQL command.

2. Use a filter on the table if it's a small table or a local table.
For a non-local table (network) or for a large table, better use a TQuery.

I've sent you an e-mail for more details.

Related Articles and Replies:

[ Delphi Forum ]
[ DelphiLand: free Delphi source code, tips, tutorials ]