IBDAC using dbedits as master and dbgrid as detail with generators

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
marcosdoni
Posts: 5
Joined: Thu 20 Jun 2013 19:32

IBDAC using dbedits as master and dbgrid as detail with generators

Post by marcosdoni » Thu 20 Jun 2013 19:51

As an example:

I have firebird tables:


TB_CUSTOMER

IDCUSTOMER (autoincrement generator)
CUSTOMERNAME

TB_PHONE

IDPHONE
IDCUSTOMER (foreing key from TB_CUSTOMER)
PHONE

TB_PHONE is handled using a dbgrid. But, I can not assign IDCUSTOMER field value in TB_PHONE because it has not yet been generated in firebird generator.


Any sugest?

AndreyZ

Re: IBDAC using dbedits as master and dbgrid as detail with generators

Post by AndreyZ » Fri 21 Jun 2013 05:49

You can get the next value from the generator using the following SQL statement:

Code: Select all

select next value for generator_name from rdb$database
, and use it in both your tables as the new value of the IDCUSTOMER field. For more information about generators, please refer to http://www.firebirdsql.org/manual/generatorguide.html

Post Reply