Get value of primary index?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Get value of primary index?

Post by kaffeburk » Sun 14 May 2017 18:17

Hello,

When i use uniquery for mysql, how do i get the value of the just inserted primary key to the last record entered? (the value is set by mysql) Im using uniquery by a datasetprovider and i want the primary key after each insert (or append).

Regards,

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Get value of primary index?

Post by ViktorV » Tue 16 May 2017 13:26

This question is related to the specificity of working with TClientDataset, but not UniDAC. Therefore, to get an answer to the question, please refer to Embarcadero documentation, for example http://edn.embarcadero.com/article/20847 or ask a question at specialized forums.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: Get value of primary index?

Post by kaffeburk » Tue 16 May 2017 13:39

Apology's if i waw unclear. I'm not asking how i get the value from the provider or from the clientdataset. I'm asking how i get the value from tUniquery.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: Get value of primary index?

Post by kaffeburk » Tue 16 May 2017 13:48


ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Get value of primary index?

Post by ViktorV » Tue 16 May 2017 14:29

UniDAC fills in auto-incremental fields automatically on inserting a new record to a dataset.
In order to get a detailed answer, please compose a small sample demonstrating the issue and send it to us using the contact form https://www.devart.com/company/contactform.html, including scripts for creating and filling database objects.

kaffeburk
Posts: 214
Joined: Mon 29 Jan 2007 08:03

Re: Get value of primary index?

Post by kaffeburk » Tue 16 May 2017 15:31

Done.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Get value of primary index?

Post by ViktorV » Wed 17 May 2017 07:40

To solve your problem, please set the TUniQuery.LocalUpdate property to False.
In the LocalUpdate mode data in dataset are changed locally but information about changes is not stored. So you cannot send the changes to the database.
For more information about these modes, please refer to UniDAC help:
https://www.devart.com/unidac/docs/inde ... update.htm

Post Reply