Subject | Re: [IBO] RefreshRows, RefreshKeys |
---|---|
Author | Andreas Bednarek |
Post date | 2004-04-06T12:19:13Z |
> Really, you shouldn't be using a technique like this with a client/serverThanks Helen, but I need to now the key value of the (possibly) new record
> database at all:
> a) it should be done on the server
> b) the keys should not be dependendent on one another's values
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!in
> >
> >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
> >ForcedWrites mode, Table1.AutoCommit = True;is
> >
> >(note: Actually this piece of code would generate a Key violation, but it
> >slightly different in the real code, there are checks for existingrecords
> >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?