读书人

怎么在一个combobox下拉条中用sql语句

发布时间: 2012-04-12 15:46:35 作者: rapoo

如何在一个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'; 

读书人网 >.NET

热点推荐