Adicionando itens ao DBComboBox

Delphi

28/10/2003

OLA AMIGOS, PRECISO DO SEGUINTE:

TENHO UMA TABELA X COM O INDICE NOME, ONDE ESTAO CADASTRADOS 10 NOMES.

QUERO QUE AO CLICAR NUM BOTAO TODOS OS REGISTROS DESTE CAMPO SEJAM ADICIONADOS NUMA DBCOMBOBOX)

NAO QUERO DBLOOKCOMBOBOX, QUERO DBCOMBOBOX MESMO..

COMO SERIA??

UM ABRAÇO


Njunior

Njunior

Curtidas 0

Respostas

Fabio.hc

Fabio.hc

28/10/2003

Tente assim:

procedure TForm1.Button1Click(Sender: TObject);
begin
   Query1.Close;
   Query1.SQL.text:=´Select indice, nome from  x´;
   Query1.Open;
   DBComboBox1.Clear;
   Query1.First;
   while not Query1.Eof do
      begin
      DBComboBox1.Items.Add(Query1.Fields[1].AsString);
      Query1.Next;
      end;
end;



GOSTEI 0
POSTAR