Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Borrar los Datasource Creados en tiempo de ejecucion (https://www.clubdelphi.com/foros/showthread.php?t=50855)

Nieto 29-11-2007 19:30:31

Borrar los Datasource Creados en tiempo de ejecucion
 
Buenas tardes,

Foro,

Ya pude hacer dinamico un pagecontrol, con "n" tabsheet y cada tabsheet con su grid y cada grid con su Datasource y cada dataset.

Codigo:
Código Delphi [-]
  
 with sk_ValidaEmpresas do begin
       First;
       while not Eof do begin
            tt := TTabSheet.Create(Self);
            tt.PageControl    := PageControlIngresos;
            tt.Caption        := FieldByName('D_Empresa_Corta').AsString;
            tt.Name           := FieldByName('K_Empresa').AsString;
            sg                := TwwDbGrid.Create(self);
            ds                := TDataSource.Create(Self);
            sp                := TStoredProc.create(self);
            ds.Name           := 'ds_'+tt.Name;
            sg.Parent         := tt;
            sg.Align          := alClient;
            sg.Name           := 'Gr'+tt.Name;
            sp.DatabaseName   :='Maveriyl';
            sp.StoredProcName :='gp_PresupuestosPorEmpresa';
            ds.DataSet        := sp; //gp_PresupuestosPorEmpresa;
            sg.DataSource     := ds;
            ds.AutoEdit       := True;
            ds.Enabled        := True;
            sp.Name           := 'Sp'+tt.Name;
            sp.Params.Clear;
           //Creacion de Parametros
            sp.Params.CreateParam(ftString,'@k_empresa',ptInput);
            sp.Params.CreateParam(ftDateTime,'@F_Inicial',ptInput);
            sp.Params.CreateParam(ftDateTime,'@F_Final',ptInput);
            sp.ParamByName('@k_empresa').AsString   := FieldByName('K_Empresa_Real').AsString;
            sP.ParamByName('@F_Inicial').AsDateTime := F_Inicial.Date;
            sP.ParamByName('@F_Final').AsDateTime   := F_Final.Date;
            try
              sP.Open;
              cuantos := sp.recordcount;
            Except
              MessageDlg('Procedimiento no pudo ser Ejecutado',mtWarning,[mbOk],0);
            end;
            Next;
       end;
   end;
Me funciona excelente, el problema es que ahora no se como borrar los datasource que fueron creados en tiempo de ejecucion

Que me falta ??

enecumene 29-11-2007 20:32:11

Hola Nieto, revisa este hilo se llama Crear y borrar componentes en tiempo de ejecucion.

Saludos.

Nieto 29-11-2007 22:12:19

Ya quedo,
utilice el TObjectList, y me funciono gracias.

Saludos


La franja horaria es GMT +2. Ahora son las 19:48:42.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi