Home > Back-end >  Adoquery how setting can not automatically submit results, it is necessary to use transaction commit
Adoquery how setting can not automatically submit results, it is necessary to use transaction commit

Time:10-28

Statements below
Fq:=TADOQuery. Create (nil);
Fq. Connection:=c_common. MBDataBase;
Fq. Close;
Fq. LockType:=ltBatchOptimistic;
Fq. SQL. Text:='... ';
Fq. ExecSQL;
This statement is automatically submitted to the database, how can do not let it automatically submits, but let me manually submit
Such as:
Fq. Connection. BeginTrans;
Fq. ExecSQL;
Fq.Connection.Com mitTrans;
How should do? The younger brother novice, masters to help you, please

CodePudding user response:

Add transaction before execSQL,
ADoconnection1. BeginTrans
Fq. ExecSQL;

Then where you want to commit, such as under the button click event and add
ADoconnection1.Com mitTrans;

  • Related