2
I have Tfdquerys created at runtime for the purpose of entering records into my database.
Table:
CREATE TABLE TABLETESTE (
ID INTEGER
);
SET TERM ^ ;
/* Trigger: TABLETESTE_BI */
CREATE OR ALTER TRIGGER TABLETESTE_BI FOR TABLETESTE
ACTIVE BEFORE INSERT POSITION 0
as
begin
if (new.id is null) then
new.id = gen_id(gen_tableteste_id,1);
end
^
SET TERM ; ^
Code:
Query1.Open('select * from TABLETESTE where 1 = 2');
Query1.Append;
Query1.Post;
showmessage(Query1.FieldByName('id').AsString); //Retorna em branco, esperado retornar o próximo id
Doubt:
It is possible to make the query automatically receive the values changed by procedures/triggers in the database when performing the post of the same?
you can call
Query1.Refresh
(I can’t remember if Firedac has the Refreshrecord method, if you have use) to update the fields before showmessage() or what you need to do with the changed field on Rigger– JMSlasher