我用table控件进行存储数据,当退出的时候我想检查一下我输入的数据是否
存入数据库,我用的是dbedit控件和table1.UpdatesPending来判断,但是无论
我怎么在dbedit1里输入数据并且ebedit1已经失去焦点,但是table1.UpdatesPending总为false。(我已经把table1.CachedUpdates:=true)
为什么呀?该怎么办呀?

解决方案 »

  1.   

    不用post吧?用dbedit不是自动post吗?
      

  2.   

    if not dmmain.tab_absentinfo.UpdatesPending then
      begin
       dmmain.tab_absentinfo.CancelUpdates;
       frmabsentinfo_input.ModalResult:=mrok;
       frmabsentinfo_input.Release;
      end
       else
       if MessageDlg('数据未保存,确定要退出吗?',mtConfirmation,[mbYes,mbNo],0) = mrYes then            
                begin
                   dmmain.Tab_AbsentInfo.CancelUpdates;
                   frmAbsentInfo_input.ModalResult:=mrok;
                   frmAbsentInfo_input.Release;
                end;无论我在dbedit中输入什么,退出的时候总也不提示我数据未保存。
    缓冲区总为空
      

  3.   

    table1.post;//存到缓存中
    //......
    if table1.UpdatesPending then     
                    talbe1.ApplyUpdates;//存到数据库并清空缓存
      

  4.   

    当我在dbedit中输入数值后,table1.UpdatesPendinghai还为false;
    为什么呀?
      

  5.   

    要执行
    table1.post;//存到缓存中,table1.UpdatesPending就为true了