form1中uses unit2而后
var
Form1: TForm1;
afm:Tform2;//添加这个
implementation
{$R *.dfm}
procedure TForm1.Edit1Click(Sender: TObject);
begin
afm:=Tform2.Create(self);
afm.Edit1.text:='Form_Edit1';
afm.Caption:='Form_edit1';
afm.ShowModal;
end;
procedure TForm1.Edit2Click(Sender: TObject);
begin
afm:=Tform2.Create(self);
afm.Edit1.text:='Form_Edit2';
afm.Caption:='Form_edit2';
afm.ShowModal;
end;
form2中添加个button、edit、dbgrid、adoquery、datasource、adoconnect各一个,在form2中设置好它们相关属性;
procedure TForm2.Button1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.clear;
sql.text:='select * from tb_1 where field_1='''+edit1.Text +'''';
open;
end;
end;
测试通过.........
代码肯定是错的
一方面
不明白意思....