入库单adoquery0 
入库明细adoquery1我在adoquery1的beforpost前加了代码:
 if 代码已存在 then
 begin
      Application.MessageBox('配件代码已存在!', '提示', Mb_Ok +MB_ICONINFORMATION);
      tblTPInList.Cancel;
      Abort;
 end;
即代码存在,不能POST。但现在的客户试用的结果是:代码有重复。
我想:即使在不同的计算机上编辑同一入库明细,发现重复代码也会Cancel。真是百思不得其解!
求各位该分析一下:在怎样的情况下?怎么保存到数据库中(D7+sql server 2000)去的?

解决方案 »

  1.   

    //在BeforePost事件中写
    procedure TForm1.qry1BeforePost(DataSet: TDataSet);
    begin
      dataSet.Cancel;
    end;
      

  2.   

    tblTPInList.Cancel与dataSet.Cancel有什么区别?
      

  3.   

    if 代码已存在 then
     begin
          Application.MessageBox('配件代码已存在!', '提示', Mb_Ok +MB_ICONINFORMATION);
          dataSet.Cancel;
          Abort;
     end;//这样写还是不行吗?
      

  4.   

    因为是网络版,无法做实验。
    1.用dataSet.Cancel会降低速度吗?
    2.在afterpost afterdel后有adoquery1.refrsh与此有关吗?