您好,欢迎来到保捱科技网。
搜索
您的当前位置:首页读书笔记2如何校验数据窗口中的数据被修改(适用于关闭窗口时

读书笔记2如何校验数据窗口中的数据被修改(适用于关闭窗口时

来源:保捱科技网


在窗口的closequery事件加入如下代码即可: integer li_ret if dw_1.deletedcount() + dw_1.modifiedcount() 0 then li_ret = messagebox(注意,数据已经被修改,是否存盘?,Question!,YesNoCancel!) choose case li_ret case 1 if dw_1.update() = 1 then c

在窗口的closequery事件加入如下代码即可:

integer li_ret


if dw_1.deletedcount() + dw_1.modifiedcount() > 0 then
li_ret = messagebox(″注意″,″数据已经被修改,是否存盘?″,Question!,YesNoCancel!)
  

choose case li_ret
  case 1
   if dw_1.update() = 1 then
   commit;
   return 0
   else
    rollback;
    messagebox(″出错″,″存盘时出错!请检查数据的正确性。″)
    return 1
   end if
  case 2
   return 0
  case 3
   return 1
 end choose
end if

另外,还可以利用窗口的CloseQuery事件在用户关闭窗口时进行确认。在CloseQuery事件中加入脚本:
  long ll_return
  ll_return = MessageBox(″提示信息″,″确认退出吗?″, Question! , YesNo! , 1 )
  if ll_return = 2 then
   Return 1

  else
   Return 0
  end if

Copyright © 2019- baoaiwan.cn 版权所有 赣ICP备2024042794号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务