Sql.Add('Select eng_name as 货品名称,part_code as 电脑编号 from SysItem where part_grp_code=' + QuotedStr(SFG)
+' or Part_grp_code=' + QuotedStr(FDG)
+' order by eng_name');

解决方案 »

  1.   

    是字符值来的呀!TO:DRIZZT:
       没找到QUOTEDSTR这个函数或方法呀
      

  2.   

    //不能用双引号,用单引号,如下:
    with frmDmEng.AQryItems do
         begin
            close;
            Sql.Clear;
            Sql.Add('Select eng_name as 货品名称,part_code as 电脑编号 from SysItem where part_grp_code=''SFG'' or Part_grp_code=''FDG'' order by eng_name');
            PrePared;
            Open;
         end;   
      

  3.   

    Sql.Add('Select eng_name as 货品名称,part_code as 电脑编号 from SysItem where part_grp_code='+''''+'SFG'+''''+'or Part_grp_code='+''''+'FDG'+''''+'order by eng_name');
      

  4.   

    QUOTEDSTR(ABC)等价于''''+'ABC'+''''
    以下是delphi6自带help描述QuotedStr function
    Returns the quoted version of a string.UnitSysUtilsCategoryString handling routinesfunction QuotedStr(const S: string): string;DescriptionUse QuotedStr to convert the string S to a quoted string. A single quote character (') is inserted at the beginning and end of S, and each single quote character in the string is repeated.Note: When working with multi-byte character systems (MBCS), use AnsiQuotedStr instead.
      

  5.   

    应写成这样
    Sql.Add('Select eng_name as 货品名称,part_code as 电脑编号 from SysItem where part_grp_code='''+IntToStr(SFG)+''' or Part_grp_code='''+IntToStr(FDG)+''' order by eng_name');
    调试成功的,快给分