[Gambas-user] DataView Help
Benoit Minisini
benoit.minisini at gambas-basic.org
Tue Jul 11 14:52:27 CEST 2023
Le 11/07/2023 à 14:40, Gianluigi a écrit :
>
> Hi Lee,
>
> Getting the identity of the added student is easy, in the Save Sub just
> type:
>
> Dim sSQL As String = "SELECT MAX(students_id) FROM students;"
> Dim i As Integer
>
> DataSource1.Save
> i = DataSource1.Connection.Exec(sSQL)[0]
> Print "STUDENT ID = "; i
>
> I still couldn't select the correct row though, I always end up
> selecting the last one
>
> Regards
>
> Gianluigi
>
If your record primary key is a serial field, you can use the
'LastInsertId' property of the 'Connection' object to get it.
Regards,
--
Benoît Minisini.
More information about the User
mailing list