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

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
TheFastCoder
Posts: 10
Joined: Mon 18 Jun 2018 06:40

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

Post by TheFastCoder » Mon 27 Jul 2020 13:54

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!

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

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

Post by oleg0k » Tue 28 Jul 2020 15:11

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

TheFastCoder
Posts: 10
Joined: Mon 18 Jun 2018 06:40

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

Post by TheFastCoder » Wed 29 Jul 2020 06:06

Thanks, that works!

oleg0k
Devart Team
Posts: 190
Joined: Wed 11 Mar 2020 08:28

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

Post by oleg0k » Wed 05 Aug 2020 08:24

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

Post Reply