{*******************************************************}
{ Add this unit to 'uses' clause of any unit of your }
{ project to allow TDBGridEh to sort data in }
{ TADOQuery automatically after sorting markers }
{ will be changed. }
{ TSQLDatasetFeaturesEh will try to find line in }
{ TADOQuery.SQL string that begin from 'ORDER BY' phrase}
{ and replace line by 'ORDER BY FieldNo1 [DESC],....' }
{ using SortMarkedColumns. }
{*******************************************************}
用的是ADO,在DBGridEh的OnTitleBtnClick事件里:
if DataModule1.ds_sql.Active then
begin
if column.Title.SortMarker=smdowneh then
DataModule1.ds_sql.Sort :=column.FieldName
else
DataModule1.ds_sql.Sort :=column.FieldName +' DESC';
end;
用的是ADO,在DBGridEh的OnTitleBtnClick事件里:
if DataModule1.ds_sql.Active then
begin
if column.Title.SortMarker=smdowneh then
DataModule1.ds_sql.Sort :=column.FieldName
else
DataModule1.ds_sql.Sort :=column.FieldName +' DESC';
end;