向tcombobox的控件中添加值
代码如下:
qry4.Close;
qry4.SQL.Text:='select fymc from sys_kjsfxm where fydm in (select fydm from zysf_zyfymx where tmh='+#39+edt1.Text+#39+')';
qry4.Open;
cbb2.Text:=qry4.FieldByName('fymc').AsString;
怎样将数据库中取得的一系列值放入combobox这个控件中呢,这个方法只能实现绑定一个数据在里面,麻烦各位前辈给点意见,怎样将所有的都绑定到里面
[解决办法]
- Delphi(Pascal) code
combobox.items.clear;qry4.first;while not qry4.eof dobeign combobox.items.add(qry4.fieldbyname('fymc').asstring); qry4.next;end;
[解决办法]
- Delphi(Pascal) code
cbb2.Clear; //先清空 while not qry4.Eof do //数据集不为空 begin cbb2.Items.Add(qry4.FieldByName('fymc').AsString) //添加 qry4.Next; //数据集跳到下一条 end;