SQLdb; persistent fields causes error lazarus / 16-Databases ---------------------------------------------------------------------- mangakissa · 2014-02-12 11:27 I use this table in firebird. Code: [Select]CREATE TABLE ADOPTIES (   ID                              BIGINT         NOT NULL,   LIDNUMMER                      VARCHAR(    15)  COLLATE ISO8859_1,   ADOPTIEBEDRAG                  DECIMAL(  6, 2),   ANIWAY                         BOOLEAN ,   ANIWAYBEDRAG                   DECIMAL(  6, 2),   ANIWAY_NAWID                    BIGINT,   STARTDATUM                        DATE,   EINDDATUM                         DATE,   BATCHDATUM                        DATE,  CONSTRAINT PK_ADOPTIES PRIMARY KEY (ID) ); In my TSQLQuery component I created persistent fields. Because some fields get some displayformats. The primary key has providerFlags = [pfInKey], all other fields set to [pfInUpdate] For this table I need the ID before saving the record. This ID is created with a select on a generator. Before posting and updating the new record I give the generated ID. The post goes right, but the update is still generating a new ID value with the trigger. It looks like ApplyUpdates is not using my filled in ID. After deleting the trigger, applyupdates occurs this error: QuoteAn error occured while applying the updates in a record: IBConnection : Execute :  -validation error for column ID, value "*** null ***" When deleting all persistent fields the record will be saved as it used to be. It has something to do with providerflags, but I don't know what. ---------------------------------------------------------------------- taazz · 2014-02-12 14:08 Show us the trigger. I'm guessing that your trigger does not check if the field is null before generating a value. ---------------------------------------------------------------------- mangakissa · 2014-02-12 14:48 Code: [Select]CREATE TRIGGER T_ADOPTIES_ID FOR ADOPTIES ACTIVE BEFORE INSERT POSITION 0 AS begin   if (NEW.ID is NULL) then NEW.ID = GEN_ID(adopties_ID, 1); end ^^ ---------------------------------------------------------------------- LacaK · 2014-02-17 06:44 Your ID field has set only [pfInKey] ? You must set both [pfInKey, pfInUpdate] ---------------------------------------------------------------------- mangakissa · 2014-02-18 15:24 Thanks LacaK. It works.