主题:急!!!请教关于DBCombobox 的用法
我的代码总是报错啊?
procedure Tjlck.DBComboBox1DropDown(Sender: TObject);
begin
// 原理:利用ADOQ1获取数据记录
// 将数据一条一条传入到Combobox中
with xhpzquery do
begin
if xhpzquery.active then
xhpzquery.Close;
xhpzquery.SQL.Clear;
xhpzquery.SQL.Add('select distinct 型号配置 * from kczb');
xhpzquery.ExecSQL ;
end;
if xhpzquery.recordcount>0 then
begin
showmessage(' xhpzquery.recordcount>0');
DBComboBox1.Items.clear;
xhpzquery.open;
DBComboBox1.Items.clear;
xhpzquery.First;
while not xhpzquery.Eof do
begin
DBComboBox1.Items.Add(xhpzquery.FieldByName('型号配置').AsString);
xhpzquery.Next;
end;
end;
end;
procedure Tjlck.DBComboBox1DropDown(Sender: TObject);
begin
// 原理:利用ADOQ1获取数据记录
// 将数据一条一条传入到Combobox中
with xhpzquery do
begin
if xhpzquery.active then
xhpzquery.Close;
xhpzquery.SQL.Clear;
xhpzquery.SQL.Add('select distinct 型号配置 * from kczb');
xhpzquery.ExecSQL ;
end;
if xhpzquery.recordcount>0 then
begin
showmessage(' xhpzquery.recordcount>0');
DBComboBox1.Items.clear;
xhpzquery.open;
DBComboBox1.Items.clear;
xhpzquery.First;
while not xhpzquery.Eof do
begin
DBComboBox1.Items.Add(xhpzquery.FieldByName('型号配置').AsString);
xhpzquery.Next;
end;
end;
end;