写可是比较麻烦,请问怎么联系?待我有时间给你写一个吧。

解决方案 »

  1.   

    简单写写
    Unit1://Form1
    implementationuses Unit2;procedure TForm1.Button1Click(Sender: TObject);//添加
    begin
      if Form2 = nil then
        Application.Create(TForm2,Form2);
      From2.ShowModal; //注意设置From2的Visible属性
      if not Unit2.Flag then Exit;
      with query2 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('Insert Into youtable(Fieldx,Fieldy) ');
        SQL.Add(' Values ( :value1,:value2 )         ');
        ParamByName('value1').Value := Unit2.value1;
        ParamByName('value2').VAlue := Unit2.value2;
        Prepare;
        try
          ExecSQL;
        except
          Application.MessageBox('插入记录失败','系统提示',mb_OK+mb_IconInformation);
          Exit; 
      end;
    end;procedure TForm1.Button2Click(Sender: TObject); //删除
    begin
      ...
      //类似添加,只是SQL语句不同;
    end;procedure TForm1.Button3Click(Sender: TObject);//修改
    begin
      ...
      //同上
    end;Unit2://Form2var
      Form2: TForm2;
      flag : Boolean;
      value1,value2: string;implementationprocedure TForm2.Button1Click(Sender: TObject);//yes
    begin
      if (Length(Trim(Edit1.Text))=0) 
       or (Length(Trim(Edit2.Text))=0) then
      begin
        Application.MessageBox('请输入费用和类别','系统提示',mb_Ok+mb_IconInformation);
        Edit1.SetFocus;//or Edit2.SetFocus;
        Exit;
      end;
      value1 := Trim(Edit1.Text);
      value2 := Trim(Edit2.Text);
      Flag   := True;
      Close;
    end;procedure TForm2.Button2Click(Sender: TObject);//cancle
    begin
      Flag   := True;
      Close;
    end;procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
      Form2 := nil;
      Action := caFree;
    end;简单就这样,提供思路,你自己扩展吧
      

  2.   

    呵呵!我给你的太简单了,楼上的说的很详细。