Subject Re: [IBO] RefreshRows, RefreshKeys
Author Andreas Bednarek
> Really, you shouldn't be using a technique like this with a client/server
> database at all:
> a) it should be done on the server
> b) the keys should not be dependendent on one another's values

Thanks Helen, but I need to now the key value of the (possibly) new record
to keep track of what record should be updated later if needed. Table1 is
used to store some settings which may or not be present.

So how can I do that?
Andreas




> >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?