const
    First = '<<';
    Next  = '>';
    Prev  = '<';
    Last  = '>>';function TDataAccess.RecordLeader(const sign :string):Integer;
begin
       case sign of //这里是错误,错误代码如下
                     First  : self.Query.First;
                     Prev   : self.Query.Prior;
                     Next   : self.Query.Next;
                     Last   : self.Query.Last;
        end;        Result := Query.RecordCount;
end;
//****************************************************************************
[Error] Database.pas(53): Ordinal type required
[Error] Database.pas(54): Incompatible types: 'Integer' and 'String'
[Error] Database.pas(55): Incompatible types: 'Integer' and 'Char'
[Error] Database.pas(56): Incompatible types: 'Integer' and 'Char'
[Error] Database.pas(57): Incompatible types: 'Integer' and 'String'
[Fatal Error] myComBox.dpr(13): Could not compile used unit 'Database.pas'

解决方案 »

  1.   

    你前面定义的那几个常量名称与delphi中的关键字重名了
      

  2.   

    delphi的case语句中只允许基本数据类型,也就是int,char,enum等,不支持string类型。
      

  3.   

    where selectorExpression is any expression of an ordinal type (string types are invalid) and each caseList is one of the following:A numeral, declared constant, or other expression that the compiler can evaluate without executing your program. It must be of an ordinal type compatible with selectorExpression. Thus 7, True, 4 + 5 * 3, 'A', and Integer('A') can all be used as caseLists, but variables and most function calls cannot. (A few built-in functions like Hi and Lo can occur in a caseList. See Constant expressions
    .)
    A subrange having the form First..Last, where First and Last both satisfy the criterion above and First is less than or equal to Last.A list having the form item1, ..., itemn, where each item satisfies one of the criteria above.
      

  4.   

    用if - else if -else 判断