如何用ADO查询出字段放入COMBOBOX列表中?(50分)

  • 主题发起人 主题发起人 夏雪宜
  • 开始时间 开始时间

夏雪宜

Unregistered / Unconfirmed
GUEST, unregistred user!
如何用ADO查询出字段放入COMBOBOX列表中?写出例子语句
 
我的一点代码
procedure Thkglf.cplbjsDropDown(Sender: TObject);
begin
cplbjs.Items.Clear;
with cplbb.ADOQuery1 do
begin
close;
sql.clear;
sql.add('select * from cplb');
open;


while not eof do
begin
cplbjs.items.Add(fieldbyname('cplb').asstring);
next;
end;
end;
end;
 
使用dbcombobox最省事
只要设置datasource和field两个属性
 
这是用函数有没有不用函数的@
 
ADOQUery1.CLose;
ADOquery1.clear;
ADOQuery1.sql.add(具体要求);
ADOQuery1.Open;
ADOquery1.first;
while not ADOQUery1.eof do
begin
Combobox1.Items.add(ADOQuery1.FieldByname('asf').asstring);
ADOQuery1.Next;
end;
把这些代码写在一个过程中就可以了。
 
同意 大花鸡.

这是 最 直观, 最好 理解的了.
 
山猫老兄:
我看了你的资料,你原来还是航空爱好者呀。你是喜欢军机还是什么?
 

Similar threads

回复
0
查看
1K
不得闲
D
回复
0
查看
849
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部