INSERT RETURNING

INSERT RETURNING

Postby jrodenhi » Thu 18 Feb 2010 23:29

How can I retrieve the value from a statement like this:
Code: Select all
INSERT INTO INVOICE(dtStatement)
VALUES('01/31/2010')
RETURNING ID

I am using a TSQLQuery to execute the statement from Delphi 2006 on a Firebird 2.1 database.

Thank you for your help.

Jack
jrodenhi
 
Posts: 9
Joined: Thu 18 Feb 2010 23:17

Postby Dimon » Tue 23 Feb 2010 10:41

To solve the problem you should add a new parameter to TSQLQuery with Name = 'ID' and ParamType = ptOutput. After this you can get ID value using the code:
Code: Select all
ID := SQLQuery.ParamByName('ID').Value;
Dimon
Devart Team
 
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Postby jrodenhi » Thu 25 Feb 2010 16:06

This works perfectly. Thanks.
jrodenhi
 
Posts: 9
Joined: Thu 18 Feb 2010 23:17


Return to dbExpress driver for InterBase & Firebird