I am using Delphi 5 and 7. When I post a new record into a table which
is keyed on an autoincrement field I do not get a result set back telling
me the number the server has allocated to the record.
I am using a TQuery component to execute the SQL statement. Are there any
way to retrieve the result set back on posting? I have checked all
associated
properties, methods and events etc... but nothing seems to work.
Immediately after insert you must to run query
SELECT last_insert_id();
and read result. But remeber that the value is valid IMMEDIATE after insert
only, before other query.