Ver Mensaje Individual
  #6  
Antiguo 22-06-2013
sleep25000 sleep25000 is offline
Miembro
NULL
 
Registrado: jun 2011
Posts: 29
Reputación: 0
sleep25000 Va por buen camino
Hola maeyanes,

He modificado el codigo a:
Código Delphi [-]
 
if BrandsLst.Count > 0 then
BrandsLst.Clear
Tal y como te indique, no tengo ningún registro en la tabla brands, no me muevo por los registros maestros, y cierro el form y todo bien, al abrir otra vez el formulario me da un error en ese mismo fragmento de código.
Yo para liberar el BrandsLst, hago lo siguiente:
Código Delphi [-]
procedure TfmHorses.FormClose(Sender: TObject; var Action: TCloseAction);
begin

  inherited;

  if Assigned(BrandsLst) then
    BrandsLst.Free;
end;

Este hereda de:
Código Delphi [-]
procedure TfmAncestor.FormClose(Sender: TObject; var Action: TCloseAction);
var
  I: Integer;
  C: TComponent;
  //DB: TClientDataSet;

begin

  Action := TCloseAction.caFree;

  // Comprobamos todos los componentes del formularios, en busca
  // de un TDataSource, y cerramos la tabla
  for I := 0 to ComponentCount - 1 do
  begin
    C := Components[i];

    // Cerramos dataset y establecemos la consulta inicial
    if (C is TDataSource) and (Assigned(TDataSource(C).DataSet)) then
    begin
      TDataSource(C).DataSet.Close;

      if TDataSource(C).Name = 'dsAllRows' then
        with TDataSource(C).DataSet as TClientDataSet do
          CommandText := SQL;
    end;
  end;
end;
Responder Con Cita