Subject Re: [IBO] Tables with PK AutoGen
Author Svein Erling Tysvær
--- In IBObjects@yahoogroups.com, "Daniel Jimenez" wrote:
> Prior to the email post I tried:
>
> AnsiString AGenerator = "AC_ID=GEN_AC_NEW_ID";
> qryAlarms->GeneratorLinks->Add(AGenerator);
>
> And the table has the following trigger defined:
>
> SET TERM ^^ ;
> CREATE TRIGGER T_AC_NEW_ID FOR ALARMCODES ACTIVE BEFORE INSERT
POSITION 0 AS
> BEGIN
> IF( (new.AC_ID IS NULL) OR (new.AC_ID < 1) )THEN
> new.AC_ID = Gen_ID(GEN_AC_NEW_ID, 1);
> END
> ^^
> SET TERM ; ^^

This seems just fine, danieL. Though I do not know what happens if you
do the GeneratorLinks->Add on a prepared or open dataset.

HTH,
Set