Query1.Close;
   Query1.SQL.Clear;
   Query1.SQL.Add('select * from ub_LWXX where 类型='政治'');
   Query1.Open;
执行到‘Query1.SQL.Add('select * from ub_LWXX where 类型='政治'');’就错误
[Error] frm_Lwxxgl.pas(231): Illegal character in input file: '政' ($D5FE)帮忙看看,我感觉我的语句是对的

解决方案 »

  1.   

    写错了啊,应该改成Query1.SQL.Add('select * from ub_LWXX where 类型=''政治''');
    这样就没错了。
      

  2.   

    Query1.SQL.Add('select * from ub_LWXX where 类型=''政治''');
    注意引号个数
      

  3.   

    想不到有人回答了
    再换一个答案
    uses
      strutils;Query1.SQL.Add(Format('select * from ub_LWXX where 类型=%s',[QuotedStr('政治')]));
    用这样的语句可以减少出错的概率,尤其是在参数比较多的时候
      

  4.   

    还有答案
    Query1.SQL.Add('select * from ub_LWXX where 类型='+chr(39)+'政治'+chr(39));
      

  5.   

    Query1.SQL.Add('select * from ub_LWXX where 类型='+quotedstr('政治')),这样也可以的