SQL Server database deletion Process

Source: Internet
Author: User

 

This is a process of deleting data in the database in VB. After clicking the buttonProgramThe first sentence is to save the location of the record you want to delete as a bookmark to the variable mybookmark. Then, if you choose to delete the record, first execute the first sentence under the IF statement.

MRC. movenext

That is to point the current record to the next record. If this "Next" record is already the next of the last record, it is the place where the null record is located (if MRC. EOF), then point the current record to the first record, because the current record cannot be blank (if you want to explain it in detail, I have already discussed it in the previous blog, this is an understanding of EOF and BOF), and then save the current record bookmarks after movernext in the mybookmark variable to overwrite the original location, then, move the current location to the data you want to delete and execute the delete statement.

MRC. movelast

MRC. Delete

This completes the deletion of the specified record. The next step is to display the next record of the record you want to delete before you delete it, because you have saved the record to mybookmark before, so you just need to assign the value back.

MRC. Bookmark = mybookmark

Then, use the custom viewdata () function to display it.

In the first else, movenext does not point to an empty zone. First, save the bookmarks of the movenext record (the next record of the record to be deleted) in mybookmark, and then

Moveprevious

Return to the record you want to delete and execute the DELETE command.

MRC. Delete

Then, the previous record is assigned to the bookmarks as the current record.

MRC. Bookmark = mybookmark

Then display the current record

Call viewdata

Not to mention the last Else.

Related Article

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.