有两个combobox控件需要在第一个控件选中产品A时,第二个控件中出现A产品的部件信息
第一个控件选中产品B时,第二个控件出现B产品的部件信息我在网上找了些例子,但是总是说有问题
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('select distinct Component_name from productcomponent');
sql.Add('where product_name=:s0');
params[0].AsString:=ComboBox1.Text;
open;
first;
comboBox2.Items.Clear;
while not eof do
begin
ComboBox2.Items.Add(fieldbyname ('Component_name').value);
next;
end;
end;
end;有两个错误
undeclared identifier :params
could not compile used unit
求教应该怎么解决
请说的详细点,我是菜鸟,谢谢啊
第一个控件选中产品B时,第二个控件出现B产品的部件信息我在网上找了些例子,但是总是说有问题
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('select distinct Component_name from productcomponent');
sql.Add('where product_name=:s0');
params[0].AsString:=ComboBox1.Text;
open;
first;
comboBox2.Items.Clear;
while not eof do
begin
ComboBox2.Items.Add(fieldbyname ('Component_name').value);
next;
end;
end;
end;有两个错误
undeclared identifier :params
could not compile used unit
求教应该怎么解决
请说的详细点,我是菜鸟,谢谢啊
应该是Parameters吧.
parameters刚试了,结果问题变成undeclared identifier :asstring 了
要怎么解决啊
谢谢
ADOquery1.SQL.Add('select * from stuinfo where 性别=:xb');
ADOquery1.Parameters.ParamByName('xb').Value:=trim(edit3.text);
ADOquery1.Open;