DP News-Robot |
30. Aug 2018 06:50 |
Secrets Of FireDac: Last Inserted Auto Generated Id And Enterprise Connectors
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:
|