Ver Mensaje Individual
  #8  
Antiguo 10-12-2016
Avatar de bulc
bulc bulc is offline
Miembro
 
Registrado: jun 2010
Posts: 415
Reputación: 14
bulc Va por buen camino
Como lo he arreglado yo.

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; //Needed
      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;  // Necessary
      UDataModul4.FDataModul4.ClientDataSet1.IndexFieldNames:= 'NUM';   // <-- Esto eliminó el Error: 'Grid Index Out of Range'
      DBGrid1.Enabled:= True;
Responder Con Cita