Re: how can obtain the OID of the last insert ? - Mailing list pgsql-odbc

From Simeó Reig
Subject Re: how can obtain the OID of the last insert ?
Date
Msg-id 006001c3af8e$c2a55da0$0500a8c0@incofisa.com
Whole thread Raw
In response to how can obtain the OID of the last insert ?  (Augusto Meza Lizardi <mezal74@yahoo.com>)
List pgsql-odbc
Public Function retornaIdUltimaInserció(Secuencia As String) As Long

 On Error GoTo errorsRetornaIdFinca

    Dim rst As New ADODB.Recordset
    Dim SQL As String
    Dim idTrobat As Long

    idTrobat = 0

    SQL = "SELECT currval ('" & Secuencia & "');"

    Set rst = conexioADO.Execute(SQL, , adCmdText)
    idTrobat = rst.Fields.Item(0).Value
    rst.Close
    Set rst = Nothing

    retornaIdUltimaInserció = idTrobat
    Exit Function

errorsRetornaIdFinca:


    MsgBox "Error a errorsRetornaCURRVAL " & Err.Number & " " &
Err.Description


End Function

----- Original Message -----
From: "Augusto Meza Lizardi" <mezal74@yahoo.com>
To: <pgsql-odbc@postgresql.org>
Sent: Sunday, November 16, 2003 9:52 PM
Subject: [ODBC] how can obtain the OID of the last insert ?


> Hi, i am using ODBC for Postgresql  with Visual Basic
> 6, somebody know how can obtain the oid for the last
> row inserted ?
>
> I try with :LASTOID ,but when i send the instruction
> "SELECT :LASTOID" return a error parser in the ":",
> the same error pass with the select in a stored
> procredure, this work fine only in plsql.
>
> Any idea ?
>
> Thanks
> Augusto
>
> _________________________________________________________
> Do You Yahoo!?
> Información de Estados Unidos y América Latina, en Yahoo! Noticias.
> Visítanos en http://noticias.espanol.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend


pgsql-odbc by date:

Previous
From: "Markus Donath"
Date:
Subject: stable driver for multithreaded environment (IIS 5.X)
Next
From: Sunil Thomas
Date:
Subject: pls help