Board index » delphi » sorting a table by clicking on the column heading

sorting a table by clicking on the column heading

does anyone know what the code is to do a table sort by clicking on
the column header? like the email programs will do?

Thanks, Shanna Hawley

 

Re:sorting a table by clicking on the column heading


If you use a TQuery object in conjunction with your DBGrid it's a snap
to re-sort:

procedure TForm1.DBGrid1TitleClick(Column: TColumn);
begin
    with Query1 do
    begin
        Close;
        Sql.Clear;
        sql.Add('Select * from ORDERS');
        Sql.Add('Order by ' + Column.FieldName);
        Open;
    end;
end;

In article <37dd5c60.572...@news.wans.net>,

Quote
  shan...@wans.net wrote:
> does anyone know what the code is to do a table sort by clicking on
> the column header? like the email programs will do?

> Thanks, Shanna Hawley

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Other Threads