Page 1 of 1

TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Tue 13 Jun 2017 14:28
by StefanDWC
Hello,

when i post a new record into a table via TUniQuery.Post methode, expect i in the AfterPost event that the record is complete posted and refreshed so that i can read all field values, including the identity/autoinc field.
However, it seems the event fires too early. All fields which will be filled by the database are still not there. Only if i overwrite the DoAfterPost methode will i see all fields are properly filled.
So, the AfterPost event is useless. At least as the LastInsertId will not be filled from the component.

Over which explicit way can i get information about a newly posted record? Especially about the record no. or the value of an identity/autoinc field?

Re: TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Wed 14 Jun 2017 07:49
by azyk
We cannot reproduce the specified problem. Please send the CREATE script of the table, on which it is reproduced.

Re: TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Wed 14 Jun 2017 14:05
by StefanDWC
Hello Azyk,

you are fully right. With the information i gave you, is it not possible to reproduce it :oops:
I will write a small sample app and provide this for further tests.

It seems that it happens in the case that the TUniQuery have a active record filter.
I was confused because, with the previously uses database components, got i in the AfterPost event a value similar to the LastInsertId. Which i have used to reach the newly created record.

However, with the TUniQuery component can i try what i want, the LastInsertId is always zero.

Re: TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Thu 15 Jun 2017 06:15
by azyk
We will be waiting for a sample from you. You can send it using the contact form at our website: http://www.devart.com/company/contactform.html

Re: TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Mon 19 Jun 2017 08:05
by StefanDWC
Hello Azyk,

thanks for the link.

However, since i know that the LastInsertId is really not provided for SQL Server, had i to find another solution which should work fine.
As long we find out why there is still a lot of network load in table and query if FetchAll = False and FetchRow = 1. Demo and description have i already send.

Re: TUniQuery, MS SQL Azure, new record is not complete in AfterPost event

Posted: Thu 22 Jun 2017 08:27
by ViktorV
We have received your sample. We will investigate it and inform you about the results.