[Lazarus] TSQLQuery: Getting autoincremented ID value after insert (MySQL)

Marcos Douglas md at delfire.net
Thu Nov 13 17:26:32 CET 2014


On Thu, Nov 13, 2014 at 11:07 AM, Reimar Grabowski <reimgrab at web.de> wrote:
> Hi,
>
> first of all I am new to using Lazarus/FPC for database communication.
> I have set up my database connection, transaction and queries via the Object Inspector and all is working as it should. But I have a little problem getting the PK value of a newly inserted record (the PK field is an auto-incremented one).
> Actually it's not really a problem, I just don't like the way I do it and found no better one.
>
> [snip]
>

Hi,
Take a look in Greyhound project: https://github.com/mdbs99/Greyhound

Here you can see an example using "last id":
https://github.com/mdbs99/Greyhound/blob/master/test/ghsqltest.pas#L285

Regards,
Marcos Douglas




More information about the Lazarus mailing list