我原来的程序是拿delphi5写的,编译通过执行都没有问题,可是我转换到delphi7后,竟然有错误
具体如下
Line too long(more than 1023 characters)
不知道大家有没有遇到过这种问题,是怎么解决的
备注:我的语句并不长

SQLStr:='Select Substr(Dwmc,1,8) Dwmc,Count(*) Num from AA where Jcyy is null and Substr(Dwmc,1,7)='''+ copy(workcode,1,7) +''' and Qdsj between '''+ BeginYear +'-'+ BeginMonth +'-'+ '01' + '''and ''' + EndYear +'-'+ EndMonth +'-'+ '31'+''' group by Substr(Dwmc,1,8) ';

解决方案 »

  1.   

    超过250自己就不行了SQLStr := 'Select Substr(Dwmc,1,8) Dwmc,Count(*) Num from AA where';
    SQLStr := SQLStr + ' Jcyy is null and Substr(Dwmc,1,7)='''+ copy(workcode,1,7) +''' and Qdsj between '''+ BeginYear +'-'+ BeginMonth +'-'+ '01' + '''and ''' + EndYear +'-'+ EndMonth +'-'+ '31'+''' group by Substr(Dwmc,1,8) ';分开写啊
    还有就是用参数方式
    ’Select * from TableName where param1 = :value1 and param1 = :value2.........‘
    这样更简介
    更容易阅读和修改
      

  2.   

    sqlstr := 'select * from ' + 
               'table '+
               'order by id';