谢谢大家!
是这样的:
在delphi中做数据库查询时,有这样一句语句:
Adoquery1.SQL.Add('select * from examine where sprm=学习');
Adoquery1.SQL.open;
可执行却是错误的!请问,应该怎么写这条语句?
谢谢大家!
数据库是access.
sprm是文本字段。

解决方案 »

  1.   

    Adoquery1.SQL.Add('select * from examine where sprm='''+'学习'+'''');
      

  2.   

    Adoquery1.SQL.Add('select * from examine where sprm ='+ ''''+'学习'+'''');
      

  3.   

    Adoquery1.SQL.Add('select * from examine where sprm=' + QuotedStr('学习'));
      

  4.   

    str:='select * from examine where sprm ='+ ''''+'学习'+'''';
    Adoquery1.SQL.Add(str);
      

  5.   

    Adoquery1.SQL.Add('select * from examine where sprm=''学习'' ');字符串常量要用两个单引号括起来... 
      

  6.   

    谢谢大家,如果学习是edit1.text呢?
      

  7.   

    Adoquery1.SQL.Add('select * from examine where sprm=' + #39 + Edit1.Text + #39);
      

  8.   

    谢谢大家! wenkai(看海)的方法已经帮我实现了!
    由于时间紧,没有对其他朋友的语句调试!
    请大家谅解,再次谢谢大家!