Re: how can obtain the OID of the last insert ?

Поиск
Список
Период
Сортировка
От Simeó Reig
Тема Re: how can obtain the OID of the last insert ?
Дата
Msg-id 006001c3af8e$c2a55da0$0500a8c0@incofisa.com
обсуждение исходный текст
Ответ на how can obtain the OID of the last insert ?  (Augusto Meza Lizardi <mezal74@yahoo.com>)
Список 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 по дате отправления:

Предыдущее
От: "Markus Donath"
Дата:
Сообщение: stable driver for multithreaded environment (IIS 5.X)
Следующее
От: Sunil Thomas
Дата:
Сообщение: pls help