The cachedupdates of tquery must be used together with the tupdatesql control.

Source: Internet
Author: User

Exesql directly executes SQL statements, but it has nothing to do with cachedupdates.

Cachedupdates is used to cache the modified data in tTable or tquery until it is called.
Applyupdates.

Applyupdates submits the data that has been modified but submitted in tquery or tTable,
And only cachedupdates of the tquery or tTable object is set to true and active to true,
State = dsbrowse.

The cachedupdates of tquery must be used with the tupdatesql control.
For example:
Query1. SQL. Text: = 'select field1, field2 from table1 ';
Query1.cachedupdates: = true;
Query1.updateobject: = updatesql1;
Updatesql1.insertsql: = 'insert Table1 (field1, field2) values (: field1,: field2 )';
Updatesql1.deletesql: = 'delete from Table1 where field1 =: field1, field2 =: field2 ';
Updatesql1.modifysql: = 'Update Table1 set field1 =: field1, field2 =: field2 where field1 =: old_field1 and field2 =: old_field2;

Query1.open;
Query1.first;
While not query1.eof do begin
Query1.edit;
Query1.fieldbyname ('field1'). asstring: = '20140901 ';
Query1.post; // data is not submitted to the background at this time.
Query1.next;
End;
Query1.database. starttransaction
Try
Query1.applyupdates;
Query1.database. commit;
Except
Query1.database. rollbback;
Raise;
End;
Query1.commitupdates;

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.