Como Adicionar campo em Cds em tempo de execução

Delphi

30/12/2004

Pessoal quero usar um Cds para todos os relatórios, como faço pra criar os campos em tempo de execução e colocando o tipo ( integer, string ) etc.

Grato pela Atenção


Michel

Michel

Curtidas 0

Respostas

Rafs

Rafs

30/12/2004

O código abaixo está no Help do Delphi.
Ele mostra como criar um ClientDataSet e seus Fields.

procedure TForm1.FormCreate(Sender: TObject);

begin
  with ClientDataSet1 do
  begin
    with FieldDefs.AddFieldDef do 
    begin
      DataType := ftInteger;
      Name := ´Field1´;
    end;
    with FieldDefs.AddFieldDef do
    begin
      DataType := ftString;
      Size := 10;
      Name := ´Field2´;
    end;
    with IndexDefs.AddIndexDef do
    begin
      Fields := ´Field1´;
      Name := ´IntIndex´;
    end;
    CreateDataSet;
  end;
end;



GOSTEI 0
Michel

Michel

30/12/2004

Obrigado Cara..


GOSTEI 0
POSTAR