Hello.
I'm inserting a new record in a table with an identity column.
It's possible to retrieve the value generated on this new record after the post is finished?
Thanks,
Ronaldo.
Get new Identity Inserted in ClientDataSet (Delphi + SQL Server with Devart)
-
- Posts: 14
- Joined: Wed 14 Nov 2012 12:59
Re: Get new Identity Inserted in ClientDataSet (Delphi + SQL Server with Devart)
Hi Ronaldo!
Thanks for contacting us.
TDataSetProvider independently generates an SQL statement for adding a record to the database.
We cannot influence which SQL statement will be generated by TDataSetProvider.
Not the best option, but to update the records you can reopen the dataset, for example:
You can fully work with SQL Server using Devart dbExpress Driver for SQL Server. But we recommend you to use our other SDAC components: https://www.devart.com/sdac/ and UniDAC: devart.com/unidac. They are better in performance and functionality than using dbExpress technology, and also allow you to get the value of the identifier when adding a record.
Best regards,
Sergey
Thanks for contacting us.
TDataSetProvider independently generates an SQL statement for adding a record to the database.
We cannot influence which SQL statement will be generated by TDataSetProvider.
Not the best option, but to update the records you can reopen the dataset, for example:
Code: Select all
ClientDataSet1.Close;
ClientDataSet1.Open;
Best regards,
Sergey
-
- Posts: 1
- Joined: Mon 14 Feb 2022 04:29
Re: Get new Identity Inserted in ClientDataSet (Delphi + SQL Server with Devart)
That is very helpful! thank youStellar wrote: ↑Tue 08 Feb 2022 15:48 Hi Ronaldo!
Thanks for contacting us.
TDataSetProvider independently generates an SQL statement for adding a record to the database.
We cannot influence which SQL statement will be generated by TDataSetProvider.
Not the best option, but to update the records you can reopen the dataset, for example:
You can fully work with SQL Server using Devart dbExpress Driver for SQL Server. But we recommend you to use our other SDAC components: https://www.devart.com/sdac/ and UniDAC: devart.com/unidac. They are better in performance and functionality than using dbExpress technology, and also allow you to get the value of the identifier when adding a record.Code: Select all
ClientDataSet1.Close; ClientDataSet1.Open;
Best regards,
Sergey
Re: Get new Identity Inserted in ClientDataSet (Delphi + SQL Server with Devart)
Hi Ronaldo!
Thank you for your reply! I was happy to assist you!
In case you have any further questions about our products, please feel free to contact us any time!
Best regards,
Sergey
Thank you for your reply! I was happy to assist you!
In case you have any further questions about our products, please feel free to contact us any time!
Best regards,
Sergey