case AdoQuery1.Fields[0].Text of
    'DCA01':
    begin
      Form01.show;
    end;
 end; 
难道只能使用if else吗?

解决方案 »

  1.   

    case selectorExpression of  caseList1: statement1;
      ...
      caseListn: statementn;
    end
    where selectorExpression is any expression of an ordinal type (string types are invalid)
      

  2.   

    你的意思是String型的变量不能使用case of 进行判断吗?
      

  3.   

    我也遇到过string 型的变量不能使用case of .
    关注。
      

  4.   

    string 类型本来就是不能用case of的,  不过可以变动一下, 
    var
        m_strings: TStrings;m_strings := TStrings.Create;
    m_strings.add('');
    ..
    case m_strings.indexOf of
        *: ...
        *: ...
    end
      

  5.   

    感谢angelface(§梨花带雨§) 和Dlwxn(流云) !