Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Delphi-News aus aller Welt (https://www.delphipraxis.net/58-delphi-news-aus-aller-welt/)
-   -   Secrets Of FireDac: Last Inserted Auto Generated Id And Enterprise Connectors (https://www.delphipraxis.net/197714-secrets-firedac-last-inserted-auto-generated-id-enterprise-connectors.html)

DP News-Robot 30. Aug 2018 05: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:


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:47 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz