我在使用AdoQuery中的where  条件时,出现列名无效,可是把同样的sql语句写到AdoQuery中的Sql属性框中就能  执行!请教为什么?谢谢!请给我E-Mail谢谢!!  
[email protected]  query1.Close;
   query1.SQL.Clear;
   query1.SQL.Add('select QY,THDW from xs');
   query1.SQL.Add('where QY="0001"');
   query1.Open;

解决方案 »

  1.   

    我在使用AdoQuery中的where  条件时,出现列名无效,可是把同样的sql语句写到AdoQuery中的Sql属性框中就能  执行!请教为什么?谢谢!请给我E-Mail谢谢!!  
    [email protected]  query1.Close;
       query1.SQL.Clear;
       query1.SQL.Add('select QY,THDW from xs');
       query1.SQL.Add('where QY="0001"');
       query1.Open;
      

  2.   

    你的SQL字符串中少了一个“空格”,你上面列出的SQL字符串组合后实际是:
    ‘select QY,THDW from xswhere QY="0001"'在“XS”之后或者“Where”之前加上一个“ ”即可。