Write the following code in the DBGrid event TitleClick, I am using MemTableEh, you can according to their own habits, look with which the return value is the DataSet control, no matter which should have its think should sorting method, such as the following written to OK, didn't they say write so trouble
If the Copy (MemTableEh1 SortOrder, Length (Column. FieldName) + 2, 1)='A' then MemTableEh1. SortOrder:=Column. FieldName + 'DESC' The else MemTableEh1. SortOrder:=Column. FieldName + 'ASC';