Page 1 of 1

TIBCTable with Firebird AutoInc (IDENTITY) field isn't working

Posted: Mon 27 Jul 2020 13:54
by TheFastCoder
Hello,

I have this Firebird 3.x Table:

CREATE TABLE MyTable (
ID SMALLINT GENERATED BY DEFAULT AS IDENTITY,
...
);

I want to use it with a TIBCTable. I insert a new record, post it, select another record, go back to the newly inserted record. If I want to edit this record than this error is shown:

Refresh failed. Found 0 records.

DBMonitor says:
SELECT NULL FROM myTable
WHERE
ID IS NULL AND ...
FOR UPDATE WITH LOCK

Why ID is null? How to get the generated ID from the AutoInc (IDENTITY) field back to the TIBCTable/record?

If played arround 1 hour, but I can't make it work. Which properties must be set with which values?

I have:
MyIBCTableID.Required = false (otherwise posting is not possible)
MyIBCTableID.AutoGenerateValue = arAutoInc
MyIBCTable.Options.ReturnParams = true
MyIBCTable.Options.DefaultValues = true
MyIBCTable.IndexFieldNames = ID
MyIBCTable.KeyFieldNames = ID
MyIBCTable.LockMode = lmLockImmediate

Thank you!

Re: TIBCTable with Firebird AutoInc (IDENTITY) field isn't working

Posted: Tue 28 Jul 2020 15:11
by oleg0k
Hello,
You can use the DMLRefresh property to implement the behavior you described : https://www.devart.com/unidac/docs/deva ... efresh.htm

Code: Select all

MyIBCTable.DMLRefresh := True;
wbr, Oleg
Devart Team

Re: TIBCTable with Firebird AutoInc (IDENTITY) field isn't working

Posted: Wed 29 Jul 2020 06:06
by TheFastCoder
Thanks, that works!

Re: TIBCTable with Firebird AutoInc (IDENTITY) field isn't working

Posted: Wed 05 Aug 2020 08:24
by oleg0k
Hello,
Thank you for the interest to our product.
It is good to see that the problem has been solved.
If you have any questions during using our products, please don't hesitate to contact us - and we will try to help you solve them.

wbr, Oleg
Devart Team