Como transformar campo de um tabela do Mysql em variavel no Delphi?

Delphi

14/04/2014

Olá a Todos,

tenho o meu banco de dados que está conectado ao Delphi via mydac, em uma tabela queria transformar um campo em uma variavel no Delphi, especificamente uma coluna com 50 linhas para um Array [1..50] of double, como posso fazer isso?
Artur Lourenco

Artur Lourenco

Curtidas 0

Respostas

Artur Lourenco

Artur Lourenco

14/04/2014

descobri ta ai:

procedure TForm1.Button1Click(Sender: TObject);

var myArray: array [1..50] of double;
a: integer;

begin

a:= 1;
 DataModule2.MyQuery1.Open;

    while not DataModule2.MyQuery1.EOF do //loop until we reach the end of the dataset
    begin
    myArray[a] := DataModule2.MyQuery1Qob.Value; //read the field value to the array
    DataModule2.MyQuery1.Next;
    inc(a); //next array index
    end;

    Edit1.Text:= floattostr(myArray[50]);

end;

end.
GOSTEI 0
POSTAR