sql:='select top '+inttostr(fpagesize)+' * from '+
      '('+self.rsql.text+') as aaa where '+
      fid+'>(select max('+fid+') from (select top '+
      inttostr((fpageno-1)*fpagesize)+
      ' '+fid+' '+' from '+ftable+' order by '+fid+') as t';showmessage(sql)显示为4行,我只想显示为一行,怎么做?

解决方案 »

  1.   

    sql是个什么东西??是TQuery.SQL吗?
      

  2.   

    用下面的TrimX函数可以让它显示为一行
    sql := Trimx(sql);
    ShowMessgae(sql);//清除控制符
    function TrimX(const S: string): string;
    var
      I, L: Integer;
    begin
      I := 1;
      Result := S;
      while (I <= Length(Result)) do
      begin
       if Result[I] <= ' ' then
       begin
         Delete(Result,I,1);
         Dec(I);
       end;
       Inc(I);
      end;
    end;
      

  3.   

    上面TimX把空格也清除了,稍微改下把if Result[I] <= ' ' then
    改 if Result[I] < ' ' then^^