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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 15:07:30962browse

在窗口的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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn