类型问题

scvzhang 2003-08-05 07:53:12
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型的啊~
...全文
40 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
deniler 2003-08-05
  • 打赏
  • 举报
回复
既然Year是integer了,怎么还能和字符串连接(+)呢?
older 2003-08-05
  • 打赏
  • 举报
回复
DecodeDate(now, vYear, vMonth, vDay);
strsql:=format('select year from table where year=%d',vyear-1);
itlcx 2003-08-05
  • 打赏
  • 举报
回复
我覺得是strsql:='select year from table where year='+year+'-1';
這句有錯,
(+year+)中的year應該是string型
knock 2003-08-05
  • 打赏
  • 举报
回复
strsql是字符串,year是integer,这样当然是不行的,用IntToStr(Integer aa);
李_军 2003-08-05
  • 打赏
  • 举报
回复
strsql:='select year from table where year='+IntToStr(year-1);
FrameSniper 2003-08-05
  • 打赏
  • 举报
回复
对啊,你怎么可以把Word型的量直接做为字串的一部分呢?

使用IntToStr函数做下转换!

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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