Como criar While not eof com um DBGRID?

Delphi

09/05/2005

Seguinte fiz um select e joguei os dados num DBGRID, neste DBGRID criei uma coluna chamada NUMERO.

Preciso fazer um While que enquanto não for fim do DBGrid ele vá preenchedo o numero sequencial deste meu campo NUMERO.


Wgm8

Wgm8

Curtidas 0

Respostas

Kotho

Kotho

09/05/2005

Colega,

O DBGrid é um espelho do DataSet, então faça o que quer no DataSet que aparecerá no DBGrid...


GOSTEI 0
Wgm8

Wgm8

09/05/2005

Seria como?

//procedure
var
i : integer;
begin
while not DadosQ.eof do
begin
DBGrid.Columns[0] := ???
i := i+1;
end;
end;


GOSTEI 0
Silviogs

Silviogs

09/05/2005

Olá

nã seria?

//procedure
var
i : integer;
begin
while not DadosQ.eof do begin
i := i+1;
DBGrid.Columns[0] := i;
end;
end;

Silvio Guedes


GOSTEI 0
Wgm8

Wgm8

09/05/2005

Ainda sim dá o erro de incopatible types : ´TColumn´ and ´Integer´


GOSTEI 0
Kotho

Kotho

09/05/2005

Ao invés de:

DBGrid.Columns...

eu faria

DadosQ.FieldByName(´nome_do_campo´).AsInteger := i;


GOSTEI 0
Raserafim

Raserafim

09/05/2005

se vc quer numerar cada linha na grid em sequência, dá uma olhada neste tópico e vê a minha resposta.
[url]http://forum.clubedelphi.net/viewtopic.php?t=62140&start=0&postdays=0&postorder=asc&highlight=[/url]


GOSTEI 0
POSTAR