CASE combobox1.text of
'defect_kind':
begin
adoquery2.Close;
adoquery2.sql.clear;
adoquery2.sql.text:='select defect_kind_value from defect_kind';
adoquery2.Open;
with adoquery2 do
begin
while not eof do
begin
listview1.Items.AddItem(fieldbyname('defect_kind_value'));
next;
end;
end;
end;提示给出错误如下:
1.ordinal type required
2.incompatible types:'TListItem'and 'TField'
'defect_kind':
begin
adoquery2.Close;
adoquery2.sql.clear;
adoquery2.sql.text:='select defect_kind_value from defect_kind';
adoquery2.Open;
with adoquery2 do
begin
while not eof do
begin
listview1.Items.AddItem(fieldbyname('defect_kind_value'));
next;
end;
end;
end;提示给出错误如下:
1.ordinal type required
2.incompatible types:'TListItem'and 'TField'
'defect_kind':
改成 if combobox1.text = 'defect_kind' then
//Case不能用字符串
2。把listview1.Items.AddItem(fieldbyname('defect_kind_value'));
改成ListItem := listview1.Items.Add;
ListItem.Caption := fieldbyname('defect_kind_value').asString;
把combobox1.text 改成combobox.ItemIndex
2.或把listview1.Items.AddItem(fieldbyname('defect_kind_value'));
改成:listview1.Items.Add(Fieldbyname('defect_kind_value').AsString);
把combobox1.text 改成combobox.ItemIndex或者用
IF else