RE: VB, RDO, Informix Q:How to retrieve serial value after insert?
Posted in 1998
Topics: Stored Procedures & SPL, Security, Permissions & Auditing, Transactions, Locking & Isolation
On Saturday, January 10, 1998 2:44 AM, Kelly Ringwald [SMTP:Kalkin@nojunk.earthlink.net] wrote: | Hi All, | | I'm developing a multi-table rdo vb ap against an informix database. | The primary recordset uses a serial key, but I need that key value in | order to insert into several related recordsets. Does anyone know how | to retrieve that value? | | Currently I am using the following kluge: Remove the sort from the | PrimaryRecordSet SQL, Refresh, Movelast, Store Key value, Add sort | back, and refresh. There must be a better way! | | I've been looking for a way to access the SQLERRD array, but haven't | found it. | | I would appreciate any help with this, including other workarounds. | | Regards, | Kelly In a similar scenario (VB/RDO/MS SQL Server) I have written stored procedures that return the db-generated key value as well as any error information. My Transact-SQL stored procedure code wouldn't do you any good, but I would think that Informix SPL could be used similarly. By burying the insert and serial (IDENTITY) retrieval within a fast stored procedure I also sometimes have pertinent information about the insert recorded to my own transaction log table to serve as an audit trail of sorts. Again, this is all done within the context of one stored procedure so it is fast and imposes no additional network overhead. This avoids your "kluge" above and is really quite fast since the compiled stored procedure runs on the server within the database. Good luck, Darrell