显示窗体中显示记录是在定义了一个过程:procedure xianshi:
  begin
     showme.adodataset1.connection:=.....;
     showme.adodataset1.commandtext:=....;
     showme.adodataset1.active:=true;
     showme.datasource1:=..;
     showme.dbgrid1.dataset:=showme.datasource1;  end;我做了一个添加窗体,单独的一个,添加记录到库后想调用showme窗体里的显示过各,说白了就是添加完了自动去刷新,如何实现?

解决方案 »

  1.   

    adodataset1 连哪个是ADOQuery吗
    那就
    ADOQuery.close;
    ADOQuery.open;
      

  2.   

    引用另外窗体的单元,然后在另外窗体中,把需要外部调用的方法,公布出来,放在public处,然后外部就可以调用了
      

  3.   

    如果是单独的一个过程,可以建一个Unit,将公用的代码放在这个Unit里,其他几个Unit引用即可
      

  4.   

    procedure xianshi:
      begin
        showme.adodataset1.connection:=.....;
        showme.adodataset1.commandtext:=....;
        showme.adodataset1.active:=true;
        showme.datasource1:=..;
        showme.dbgrid1.dataset:=showme.datasource1;
        if showme.showmodal=mrok then //如果更新了数据
        begin
          //刷新数据
        end;
      end;