Turn: Functions of Disablecontrols and Enablecontrols in Delphi database technology

Source: Internet
Author: User

Functions of Disablecontrols and Enablecontrols in Delphi database technology
2010-12-06 10:48:43|  Category: Delphi Technology | Tags: disablecontrols enablecontrols | font size Big Small subscription
In general, the program used to scan the entire database table and modify one field per record is as follows:
With Table do
Begin
Disablecontrols; {Invalidates other parts during record modification}
First; {Point The Record pointer to the first record}
While don't EOF do
Begin
< read a field value from a record into a variable >
< make the appropriate changes >
Edit; {Place ttable part in edit state}
< write the modified field values back to their corresponding fields >
Post {Write the modified record back to the database}
Next {Modify Next record}
End
Enablecontrols; {Restore functionality of other parts}
End
The program operates on ttable parts, so it makes sense to use the WITH statement to prevent erroneous proliferation. Here you should pay attention to the use of the Disablecontrols method and the Enablecontrols method. The Disablecontrols method is to cut off the ttable part's contact with the data Access part Tdatasource part when the program modifies the record in the ttable part. Otherwise, after each modification in ttable, the Tdatasource part updates the display of all the data-browsing parts in the form, which slows down the process and wastes time dramatically. The Enablecontrols method is the opposite of the Disablecontrole method, which is used to restore the connection of the ttable part to the Tdatasource part and to facilitate all data browsing parts

Turn: Functions of Disablecontrols and Enablecontrols in Delphi database technology

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.