Re: VB, RDO, Informix Q:How to retrieve serial value after insert?
Posted in 1998
Hi Richard, Here's my generic save function as it stands now. Regards, Kelly Function nbSave(datPri As Control, datNav As Control) As Integer With datPri .Parent.MoveScrnToRs On Error GoTo ErrUpd nbsave = 0 If .Resultset.AbsolutePosition = -1 Then ' Addnew save .Resultset.Update ' Execute SPL to get last inserted id .SQL = "execute procedure GetSerialID();" .Refresh nbSave = .Resultset!Column1 If nbSave = 0 Then MsgBox "Add Rejected" End If Else ' Modify save .Resultset.Update nbSave = .Resultset.rdoColumns.Item(0) .Resultset.Bookmark = .Resultset.LastModified End If End With nbSetNavMode "view", datNav Exit Function ErrUpd: If gsErr = "" Then For Each ger In rdoErrors gsErr = gsErr + ger Next End If MsgBox gsErr nbSave = 0 End Function On Fri, 13 Feb 1998 09:55:36 +0100, Richard Spitz <richard.spitz@ana.med.uni-muenchen.de> wrote: >Kelly Ringwald wrote: >> 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. > >Kelly, > >could you please give an example of what you mean by "switching the sql >on the resultset"? > >Regards, Richard >-- >+--------------------------+------------------------------------------+ >| Dr. Richard Spitz | INTERNET: spitz@ana.med.uni-muenchen.de | >| EDV-Gruppe Anaesthesie | Tel : +49-89-7095-3413 | >| Klinikum Grosshadern | FAX : +49-89-7095-8886 | >| 81366 Munich, Germany | GSM : +49-172-8933578 | >+--------------------------+------------------------------------------+