procedure TForm1.Button1Click(Sender: TObject);
begin
  with adoquery1 do
  begin
    sql.Text:='select * from card_sale_view'+
              'where card_no=:p1';
    Parameters.ParamByName('p1').Value:=edit1.Text;
    open;
  end;
end; 看看有什么错误!

解决方案 »

  1.   

    sql.Text:='select * from card_sale_view'+
                  'where card_no=:p1';
    //这里有点错误,
    你写在一行,结果是这样的:
    sql.Text:='select * from card_sale_viewwhere card_no=:p1';
    所以,找不到表:card_sale_viewwhere,
    所以会出理SQL语法错误,
    加几个空格吧,再说了,你的SQL语句又不长,写在一行也行呀;
    说了这么多,不知对否;
      

  2.   

    第一问题见二楼..另外,估计楼主这个BUTTON只会点一次的..给QUERY里写SQL语句前不先SQL.CLEAR的偶还是第一次见..呵呵..