X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 173CFD1CA65 for ; Thu, 20 Nov 2003 17:51:18 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 77659-06 for ; Thu, 20 Nov 2003 13:50:47 -0400 (AST) Received: from mail.incofisa.com (62.Red-80-38-185.pooles.rima-tde.net [80.38.185.62]) by svr1.postgresql.org (Postfix) with ESMTP id E1A83D1D3EA for ; Thu, 20 Nov 2003 13:50:28 -0400 (AST) Received: from www (www.incofisa.com [192.168.0.5]) by mail.incofisa.com (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with SMTP id hAKHoN031221; Thu, 20 Nov 2003 18:50:24 +0100 Message-ID: <006001c3af8e$c2a55da0$0500a8c0@incofisa.com> From: =?iso-8859-1?Q?Sime=F3_Reig?= To: "Augusto Meza Lizardi" Cc: References: <20031116205248.71546.qmail@web10406.mail.yahoo.com> Subject: Re: how can obtain the OID of the last insert ? Date: Thu, 20 Nov 2003 18:50:17 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4922.1500 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4925.2800 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/99 X-Sequence-Number: 3501 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" To: 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