我用的access数据库,查询数据时,总是出错,
'Select Content from Tab_Msg where AddTime > #2005-2-1 15:19:16# '#$D#$A
这是运行时的变量值,查询出错,
请教,怎么去掉???

解决方案 »

  1.   

    回车换行
    procedure TForm1.Button1Click(Sender: TObject);
    var
      i : integer;
      Str : String;
    begin
      Str :='Select Content from Tab_Msg where AddTime > #2005-2-1 15:19:16# '+#13#10;
      i:=Pos(#13,Str);
      if i>0 then
      delete(Str,i,1);
      i:=Pos(#10,Str);
      if i>0 then
      delete(Str,i,1);end;
      

  2.   

    AddTime > #2005-2-1 15:19:16# 不知如何查
      

  3.   

    感谢,
    我不需要delphi自己带的换行符号,怎么去掉。后面这个东西是delphi自己加的
      

  4.   

    调用他就行了
    function TForm1.myfunction(StrSource : String) : String;
    var
      i : integer;
      Str : String;
    begin
      Str :=StrSource;
      i:=Pos(#13,Str);
      if i>0 then
      delete(Str,i,1);
      i:=Pos(#10,Str);
      if i>0 then
      delete(Str,i,1);
      Result:=Str;
    end;
      

  5.   

    function TForm1.myfunction(StrSource : String) : String;
    var
      i : integer;
      Str : String;
    begin
      Str :=StrSource;
      i:=Pos(#13,Str);
      while i>0 do
      begin
        delete(Str,i,1);
        i:=Pos(#13,Str);
      end;  i:=Pos(#10,Str);
      while i>0 do
      begin
        delete(Str,i,1);
        i:=Pos(#10,Str);
      end;
      Result:=Str;
    end;