Add the following code to the closequery event in the window: integerli_retifdw_1.deletedcount () + dw_1.modifiedcount () 0thenli_retmessagebox (Note: The data has been modified. Are you sure you want to save the disk ?, Question !, YesNoCancel !) Choosecaseli_retcase1ifdw_1.update () 1 thenc
Add the following code to the closequery event in the window: integer li_ret if dw_1.deletedcount () + dw_1.modifiedcount () 0 then li_ret = messagebox (Note: The data has been modified. Are you sure you want to save the disk ?, Question !, YesNoCancel !) Choose case li_ret case 1 if dw_1.update () = 1 then c
Add the following code to the closequery event in the window:
Integer li_ret
If dw_1.deletedcount () + dw_1.modifiedcount ()> 0 then
Li_ret = messagebox ("NOTE", "data has been modified. Are you sure you want to save the disk? ", Question !, YesNoCancel !)
Choose case li_ret
Case 1
If dw_1.update () = 1 then
Commit;
Return 0
Else
Rollback;
Messagebox ("error", "error when saving disk! Check whether the data is correct. ″)
Return 1
End if
Case 2
Return 0
Case 3
Return 1
End choose
End if
You can also use the CloseQuery event of the window to confirm when the user closes the window. Add a script to the CloseQuery event:
Long ll_return
Ll_return = MessageBox ("prompt message", "Are you sure you want to exit? ", Question! , YesNo! , 1)
If ll_return = 2 then
Return 1
Else
Return 0
End if