| |

VerySource

 Forgot password?
 Register
Search
View: 676|Reply: 1

adoquery update data problem

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-19 11:40:01
| Show all posts |Read mode
self.ADOQuery1.Active: = false;
self.ADOQuery1.SQL.Clear;
sqlstr: = 'select * from projectdonghua where pid =' + inttostr (pid) + 'order by did';
self.ADOQuery1.SQL.Add (sqlstr);
try
self.ADOQuery1.Open;
except
self.ADOQuery1.ExecSQL;
end;
self.ADOQuery1.First;
for i: = 1 to self.ADOQuery1.RecordCount do
  begin
    self.ADOQuery1.Edit;
    self.ADOQuery1.FieldByName ('DID'). AsInteger: = i;
    self.ADOQuery1.Post;
    showmessage (self.ADOQuery1.fieldbyname ('did'). AsString);
    self.ADOQuery1.next;
    end;
At that time, the DID was updated, but the records in the actual database were not updated. I used ADOQuery1 to disconnect and check it again. It is the same as the original. What is wrong? Thank you.
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-1-26 14:09:01
| Show all posts
Solved it by myself,

self.ADOQuery1.locktype: = ltBatchOptimistic;
self.ADOQuery1.UpdateBatch;
That's it.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list