如何在一个combobox下拉条中用sql语句显示数据库中用户名的所有内容
如何在一个combobox下拉条中用sql语句显示数据库中用户名的所有内容
[解决办法]
with adoquery do
begin
close;
sql.text:='select 用 from 用表';
open;
combobox.clear;
while not eof do
begin
combobox.items.add(fields[0].asstring);
next;
end;
end;
[解决办法]
- Delphi(Pascal) code
if ComboBox1.Items.Count >0 then ComboBox1.ItemIndex := 0;或者ComboBox1.Text := 'xxx';