Re: VB, RDO, Informix Q:How to retrieve serial value after insert?
Posted in 1998
Hi all,
Thanks for the responses on this. I got a couple of questions
off-line, so I thought I'd follow-up on this.
I use the Informix-CLI drivers, and the 'SQLGetStmtOption' didn't seem
to work on it. Using stored procedures for inserts is a good idea and
has other advantages besides.
The most useful option for me, actually came from the Informix FAQ:
4.8.4 Can I access the SQLCA via a Stored Procedure?
Yes. This means that your Delphi/Visual Basic/Whatever program can
also access the SQLCA
structure by using a Stored Procedure like this:
CREATE PROCEDURE GetSerialNumber() RETURNING integer; RETURN DBINFO('sqlca.sqlerrd1');
END PROCEDURE
After the .update, I switch the sql on the resultset to execute this
stored procedure and refresh. It is necessary to use the same
resultset which performed the insert in order to get the correct id.
Regards,
Kelly