Good morning,
I connected a TDBAdvGrid to a table which resides in a remote DB. The user is allow to edit/add/delete data via TDBAdvGrid and the user can also sort data.
After a few attemps I came out with the following code which works fine but I'd like to improve the performance:
with DBAdvGrid do begin
DoSort:=false;
try
cursor:=crHourGlass;
PageMode:=false;
if SortSettings.Direction=sdAscending then begin
SortSettings.Direction:=sdDescending;
with DBTable do
IndexFieldNames:=FieldAtColumn[ACol].FieldName+' DESC';
end
else begin
SortSettings.Direction:=sdAscending;
with DBTable do
IndexFieldNames:=FieldAtColumn[ACol].FieldName+' ASC';
end;
SortSettings.Column:=ACol;
PageMode:=not PageMode;
finally
cursor:=crDefault;
end;
end;
as I said, the code works fine but the time it takes to sort data is too long. The bottle neck seems to be when I switch PageMode at the end of the code.
Do you have any idea of how to improve the performance ?
Many thanks
Alberto