query1.sql.clear;
query1.sql.add('select * from sg where 单位 LIKE :str );
query1.parambyname('str').asstring:='%'+edit1.text+'%';
query1.open; 

解决方案 »

  1.   

    在查询事件中写:
      Query1.SQL.Close;
      Query1.SQL.Text := 'SELECT * FROM sg WHERE 单位 LIKE :p_dw';
      Query1.SQL.ParamByName('p_dw').AsString := '%' + Edit1.Text + '%';
      Query1.Open;of cause DataSource & DBGrid or else are needed.
      

  2.   

    我想在Edit1.Text两边还得加上两个#39吧!:-)