I've a TZQuery with the an insert into statement.
I run this 5 times with the same parameters in a for loop, which should result in 5 rows with different autonumbered ids.
However only one or two rows are inserted (and only those commands are visible in sql monitor).
The for loop is a bit braindead
for i:=0 to number-1 do
begin
qry.execsql;
qry.active:=true;
end;
Even if I add some parameter that forces the tuples to be different (I put the loopcounter in some memo) this still happen.
What is the proper way of doing this?
Insert multiple times gets optimized away.
Moderators: gto, EgonHugeist, olehs
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
marcov,
should be enough. If you still experience problems try replacing qry.execsql with qry.close; qry.open; commands. It you do only qry.active:=true - only the first time it gets executed as after that qry is active already and no work is done.
Good luck!
Code: Select all
for i:=0 to number-1 do
begin
qry.execsql;
end;
should be enough. If you still experience problems try replacing qry.execsql with qry.close; qry.open; commands. It you do only qry.active:=true - only the first time it gets executed as after that qry is active already and no work is done.
Good luck!