Subject | RefreshRows, RefreshKeys |
---|---|
Author | Andreas Bednarek |
Post date | 2004-04-06T07:34:25Z |
Hi everyone!
IBO4.2 (registered), FB1.5RC8
Can you tell me why this doesn't work correctly?
(pseudocode)
while (records to insert) do begin
Table1.Last;
new_key := Table1.FieldByName(KEYFIELD).AsInteger + 1;
Table1.InsertRecord([new_key, ...]);
end; {while}
If I don't insert this two additional commands before the "end; {while}"
statement
Table1.RefreshRows;
Table1.RefreshKeys;
I obtain the same new_key values for several ongoing records. The DB is in
ForcedWrites mode, Table1.AutoCommit = True;
(note: Actually this piece of code would generate a Key violation, but it is
slightly different in the real code, there are checks for existing records
also, but this illustrates the process that is performed...)
Can you help? Should I probably use RefreshRows, RefreshKeys in
AfterPost/Insert/Delete to be sure I always read the actual dataset
contents?
Thank you
Andreas
IBO4.2 (registered), FB1.5RC8
Can you tell me why this doesn't work correctly?
(pseudocode)
while (records to insert) do begin
Table1.Last;
new_key := Table1.FieldByName(KEYFIELD).AsInteger + 1;
Table1.InsertRecord([new_key, ...]);
end; {while}
If I don't insert this two additional commands before the "end; {while}"
statement
Table1.RefreshRows;
Table1.RefreshKeys;
I obtain the same new_key values for several ongoing records. The DB is in
ForcedWrites mode, Table1.AutoCommit = True;
(note: Actually this piece of code would generate a Key violation, but it is
slightly different in the real code, there are checks for existing records
also, but this illustrates the process that is performed...)
Can you help? Should I probably use RefreshRows, RefreshKeys in
AfterPost/Insert/Delete to be sure I always read the actual dataset
contents?
Thank you
Andreas