delphi combobox问题
我有张数据表:楼房号 楼层数 房间数 人数
1 4 6 4
2 4 15 4
现在想把楼房号下面的数据读取到combobox中,请问这个代码应该怎么写,有connection,Adoquery组件在
程序代码:procedure TForm1.Button1Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text := 'Select * from pub_info';
ADOQuery1.Open;
ComboBox1.Clear;
while not ADOQuery1.Eof do
begin
ComboBox1.Items.Add(ADOQuery1.FieldByName('pub_id').AsString);
ADOQuery1.Next;
end;
end;
end.