Case...of的用法出错
各位大虾,小弟下面的一段程序出错,请各位帮忙看看是哪里出毛病了,是不是Case的用法不对,多谢!!!
其中ComboBox_Exe_Cond是一个ComboBox,包括'已完成'和'未完成'两个Items.
出错信息我注在对应的行后面了.从错误信息来看,好像是要求Case后面的变量要是一个序数类型,但是在help中并没有找到这样的说法.
if Trim(ComboBox_Exe_Cond.Text) <> '' then
Case Trim(ComboBox_Exe_Cond.Text) of {错误信息:Ordinal type required.}
'已完成':{错误信息:Incompatible Types:'Integer' and 'String'}
begin
if f_Empty<>4 then
ls:= ls + 'and Exe_cond=''1'''
else
ls:= ls + 'Exe_cond=''1'''
end;
'未完成':{错误信息:Incompatible Types:'Integer' and 'String'}
begin
if f_Empty<>4 then
ls:= ls + 'and Exe_cond=''0'''
else
ls:= ls + 'Exe_cond=''0'''
end;
else begin
raise Exception.Create('合同执行情况输入错误!');
ComboBox_Exe_Cond.SetFocus;
end
end