麻烦大家进来看看下面的代码,有错误,望指教修改

see14123 2004-05-07 10:21:48
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'

...全文
74 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
mynameisking 2004-05-07
  • 打赏
  • 举报
回复
case不能用字符串的,
把combobox1.text 改成combobox.ItemIndex
miky 2004-05-07
  • 打赏
  • 举报
回复
1.CASE combobox1.text of
'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;
andy81391394 2004-05-07
  • 打赏
  • 举报
回复
case 中的判断表达式的值必须是有序类型,楼主不妨试试 nice0934的方法。
nice0934 2004-05-07
  • 打赏
  • 举报
回复
case不能用字符串的,
把combobox1.text 改成combobox.ItemIndex或者用
IF else
judicainiao 2004-05-07
  • 打赏
  • 举报
回复
1.同意 miky(miky) ,case 要用序数类型,我以为
2.或把listview1.Items.AddItem(fieldbyname('defect_kind_value'));
改成:listview1.Items.Add(Fieldbyname('defect_kind_value').AsString);

2,507

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧