From: Simeó Reig <simeo@incofisa.com>
To: Augusto Meza Lizardi <mezal74@yahoo.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: how can obtain the OID of the last insert ?
Date: Thu, 20 Nov 2003 18:50:17 +0100
Message-ID: <006001c3af8e$c2a55da0$0500a8c0@incofisa.com> (raw)
References: <20031116205248.71546.qmail@web10406.mail.yahoo.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: simeo@incofisa.com, mezal74@yahoo.com
Subject: Re: how can obtain the OID of the last insert ?
In-Reply-To: <006001c3af8e$c2a55da0$0500a8c0@incofisa.com>
References: <20031116205248.71546.qmail@web10406.mail.yahoo.com> <006001c3af8e$c2a55da0$0500a8c0@incofisa.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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