Getting generated value
Posted: Fri 05 Feb 2010 11:16
Hi!
I'm currently on a project that uses Firebird 1.0.
Assume following table structure:
where id is auto incremented by an on before insert trigger.
The code used is like this:
The problem is that generatedId is always '0'. Because the field is updated in the db, but not on the TIBCTable1's field.
I already read about using a returning clause (e.g. setting the DMLRefresh property to true) but this only seems to work for Firebird 2.0 and up.
Is there a similar way for Firebird 1.0 or do I have to somehow change the whole process.
My next try would be to use the KeyGenerator functionality, but this way I would probably have to change the database structure.
Any thoughts on this?
Thanks, amac
I'm currently on a project that uses Firebird 1.0.
Assume following table structure:
Code: Select all
nameTable(id integer primary key, name varchar(30));
The code used is like this:
Code: Select all
TIBCTable1.Append;
TIBCTable1.Edit;
TIBCTable1.FieldByName('name').AsString := 'jfdlsfj';
TIBCTable1.Post;
generatedId := TIBCTable1.FieldByName('id').AsInteger;
I already read about using a returning clause (e.g. setting the DMLRefresh property to true) but this only seems to work for Firebird 2.0 and up.
Is there a similar way for Firebird 1.0 or do I have to somehow change the whole process.
My next try would be to use the KeyGenerator functionality, but this way I would probably have to change the database structure.
Any thoughts on this?
Thanks, amac