我想得到这样一条语句:
select * from 出勤信息 where upqk='上午旷工'我是这样做的:
adoquery1.text:='select * from 出勤信息 where upqk='+'上午旷工';
但是这样不行,因为最后生成的语句成了:
select * from 出勤信息 where upqk=上午旷工;
所以提示:列名"上午旷工"无效如何把单引号也显示出来?

解决方案 »

  1.   

    adoquery1.text:='select * from 出勤信息 where upqk=''上午旷工''';
      

  2.   

    adoquery1.text:='select * from 出勤信息 where upqk=''上午旷工''';
      

  3.   

    select * from 出勤信息 where upqk='''+上午旷工+'''
      

  4.   

    adoquery1.text:='select * from 出勤信息 where upqk=''上午旷工''';
      

  5.   

    因该这样写
    'select * from 出勤信息 where upqk='+''''+'上午旷工'+''''
      

  6.   

    adoquery1.text:='select * from 出勤信息 where upqk= :s';
    adoquery1.ParamByName('s').asstring:= '上午旷工';
      

  7.   

    'select * from 出勤信息 where upqk='+quotedString('上午旷工');
      

  8.   

    adoquery1.text:='select * from 出勤信息 where upqk=''上午旷工''';