Reading Note 2 How to verify that the data in the data window is modified (applicable when the window is closed)

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.