DecodeDate(now, Year, Month, Day);
strsql:='select year from table where year='+year+'-1';
[Error] UZZGL.pas(571): Incompatible types: 'String' and 'Word'怎么会有错误?我看帮助中year是int型的啊~

解决方案 »

  1.   

    对啊,你怎么可以把Word型的量直接做为字串的一部分呢?使用IntToStr函数做下转换!
      

  2.   

    strsql:='select year from table where year='+IntToStr(year-1);
      

  3.   

    strsql是字符串,year是integer,这样当然是不行的,用IntToStr(Integer aa);
      

  4.   

    我覺得是strsql:='select year from table where year='+year+'-1';
    這句有錯,
    (+year+)中的year應該是string型
      

  5.   

    DecodeDate(now, vYear, vMonth, vDay);
    strsql:=format('select year from table where year=%d',vyear-1);
      

  6.   

    既然Year是integer了,怎么还能和字符串连接(+)呢?