Hi,
How can I receive the last inserted ID-number after a 'INSERT INTO' command in TMySQL?
Thanks,
Marc
Marc
FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Hi,
How can I receive the last inserted ID-number after a 'INSERT INTO' command in TMySQL?
Thanks,
Marc
Rick,
I was also thinking of something like that, but what if more people inserting records at the same time on a network?
I saw something like LAST_INSERT_ID() in the MySQL manual, but this function is not recogniced by my xHarbour-version.
Thanks,
Marc
Marc
A couple of suggestions on concurrency .. I have used a table that contains only 'ID-number' and when a person starts the Add process .. I append the Next number to the ID Table and store that number to a variable and when your form is ready to save .. you already have the number reserved and if someone gets in there concurrently, they get the next number in the ID table....
or
You could store the last used ID-number in a table and during the Insert routine .. increment the Last Used ID-number and append your record ..
Rick
Hello
launch a select statement
example:
oQry = oServer:Query( "SELECT LAST_INSERT_ID() AS lastinsert" )
to retrieve the value oQry:lastinsert
Daniel,
I have try it, and its working!!
Thanks,
Marc