A common pattern when inserting data into a database table which has an auto increment field set on it is to use an
SQL query to select the last inserted ID of the newly created record. Once you use your TFDQuery to run your INSERT
query you can run this second
query to get the newly inserted auto increment ID. Different databases have different
SQL queries to accomplish this.
MySQL for example has a SELECT
query function that you can run called LAST_INSERT_ID() (example: