Update a related record

oldeast

Active Member
Licensed User
Longtime User
Hi, I have db with a 2 related one to many tables.:sign0104:
When the user adds a record in the main table I want to recover the ID of the saved record for insertion into the related table foreign key.
I am using the dbutils, (thanks!:sign0142:) but not sure how to retrieve the record ID just entered..
Many thanks
 

keirS

Well-Known Member
Licensed User
Longtime User
You can do it as a query "select last_insert_rowid()" returns the rowid of the last record added to the database.
 
Upvote 0

oldeast

Active Member
Licensed User
Longtime User
Thanks...

Thanks, will check out the sqllite documentation more carefully next time.:signOops:
 
Upvote 0
Top