procedure TForm1.Button1Click(Sender: TObject);
var
x:string;
begin
x:=edit1.Text;
query1.Close;
query1.SQL.Clear;
query1.sql.Add('select * from people where 姓名='+x);
query1.open;
dbgrid1.datasource:=datasource1;
dbgrid1.refresh;
end;
end.
其中 people 为数据表名 姓名为字段名称
如在edit1中输入张玉则系统提示错误信息列名'张玉'无效