求教,Ado引号内字符串没有正确结束,该如何解决

求教,Ado引号内字符串没有正确结束
执行后,测试报这个错



procedure TForm1.Button1Click(Sender: TObject);
var T:string;
begin


  if edit1.Text <> '' then
  begin
  T:=' and t.name like ''' +'%'+edit1.Text+'%'+ ''' ' ;
  end;

  if edit2.Text <> '' then
  begin
  T:= T + ' and t.about like ''' +'%'+edit2.Text+'%'+ ''' ' ;
  end;

  if edit3.Text <> '' then
  begin
  T:= T + ' and t.about1 like ''' +'%'+edit3.Text+'%'+ ''' ' ;
  end;

  with adoquery1 do
    begin
      close;
      sql.Clear;
      sql.Text:=('select t.name,t.about,t.about1 from tpl_word1 t where t.wordtype <> ''  ''' + T + '''  ') ;
      open;
    end;
end;

------解决方案--------------------
sql.Text:=('select t.name,t.about,t.about1 from tpl_word1 t where t.wordtype <> ''  ''' + T) ;
去掉背后一个引号,见上。
------解决方案--------------------
楼主这种写法,要是edit1,edit2,edit3中有一个引号,你就惨了。
用quotedstr('%'+edit1.text+'%')这个好用。
------解决方案--------------------
sql.Text:=('select t.name,t.about,t.about1 from tpl_word1 t where t.wordtype <> ''  ' + T) ;
------解决方案--------------------
T:=' and t.name like ''' +'%'+edit1.Text+'%'+ ''' ' ; 都改为:
T := ' and t.name like ''%' + Trim(Edit1.Text) + '%''';即可。其他的语句都照这个改就行了,
还有就是像2楼说的用quotedstr就可以,防止SQL 注入可以。