Ver Mensaje Individual
  #3  
Antiguo 27-03-2012
Avatar de radenf
radenf radenf is offline
Miembro
 
Registrado: oct 2007
Ubicación: Viña del Mar,Chile
Posts: 608
Reputación: 17
radenf Va por buen camino
Estimado mcs :

Este código permite ordenar los DBGrid al hacer click en el título. Es para ADO pero lo puedes adaptar a tu BD,

Código Delphi [-]
procedure Form1.DBGrid1TitleClick(Column: TbsColumn);
begin
if DBGrid1.DataSource.DataSet is TCustomADODataSet then
with TCustomADODataSet(DBGrid1.DataSource.DataSet) do
if (Pos(Column.FieldName, Sort) = 1) and (Pos(' ASC', Sort)= 0) then
begin
Sort := Column.FieldName + ' ASC';
end
else
begin
Sort := Column.FieldName + ' DESC';
end;
Indice := Column.Index;
end;

Salu2
Responder Con Cita