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

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

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

Post by StefanDWC » Tue 13 Jun 2017 14:28

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?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

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

Post by azyk » Wed 14 Jun 2017 07:49

We cannot reproduce the specified problem. Please send the CREATE script of the table, on which it is reproduced.

StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

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

Post by StefanDWC » Wed 14 Jun 2017 14:05

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.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

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

Post by azyk » Thu 15 Jun 2017 06:15

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

StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

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

Post by StefanDWC » Mon 19 Jun 2017 08:05

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.

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

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

Post by ViktorV » Thu 22 Jun 2017 08:27

We have received your sample. We will investigate it and inform you about the results.

Post Reply