Tengo un DBGrid que carga con un select ordenado por un campo (INICIO). Al hacer otro select con otro orden (´NUM') me daba el error 'Get Index Out of Range'.
Lo arreglé cambiando el índice y haciéndolo coincidir con el nuevo índice (Campo 'NUM').
Código Delphi
[-]
UDataModul4.FDataModul4.ClientDataSet1.Active:=False; DBGrid1.Enabled:= False;
UDataModul4.FDataModul4.IBQuery1.SQL.Clear;
UDataModul4.FDataModul4.IBQuery1.SQL.Add('SELECT * FROM ADIVI WHERE (NUM > :nInt) and (NUM < :nNext) order by NUM') ;
UDataModul4.FDataModul4.IBQuery1.ParamByName('nInt').AsInteger:= nInt;
UDataModul4.FDataModul4.IBQuery1.ParamByName('nNext').AsInteger:= nNext;
UDataModul4.FDataModul4.IBQuery1.Open;
UDataModul4.FDataModul4.ClientDataSet1.Active:=True; UDataModul4.FDataModul4.ClientDataSet1.IndexFieldNames:= 'NUM'; DBGrid1.Enabled:= True;