Page 1 of 1

IBDAC using dbedits as master and dbgrid as detail with generators

Posted: Thu 20 Jun 2013 19:51
by marcosdoni
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?

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

Posted: Fri 21 Jun 2013 05:49
by AndreyZ
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