pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how can obtain the OID of the last insert ?
2+ messages / 2 participants
[nested] [flat]

* how can obtain the OID of the last insert ?
@ 2003-11-16 20:52 Augusto Meza Lizardi <mezal74@yahoo.com>
  2003-11-20 17:50 ` Re: how can obtain the OID of the last insert ? Simeó Reig <simeo@incofisa.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Augusto Meza Lizardi @ 2003-11-16 20:52 UTC (permalink / raw)
  To: pgsql-odbc

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: how can obtain the OID of the last insert ?
  2003-11-16 20:52 how can obtain the OID of the last insert ? Augusto Meza Lizardi <mezal74@yahoo.com>
@ 2003-11-20 17:50 ` Simeó Reig <simeo@incofisa.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Simeó Reig @ 2003-11-20 17:50 UTC (permalink / raw)
  To: Augusto Meza Lizardi <mezal74@yahoo.com>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-11-20 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-16 20:52 how can obtain the OID of the last insert ? Augusto Meza Lizardi <mezal74@yahoo.com>
2003-11-20 17:50 ` Simeó Reig <simeo@incofisa.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox