Hello all !
i'm working with Delphi XE8 and I'm connected to Microsoft SQL Server 2014 thru FireDAC
My question concerns the 'GetLastAutoGenValue' method of the TFDConnection :
Context :
I am posting a new record in a table, in the meantime I'm logging the transaction in a different table. In order to do so, I have to get the ID of the new record being posted (so I am in the AfterInternalPost of TDataset.Post process)
With Advantage Database Server, there is a method called AdsGetField(FieldName, optNONE) that retrieves the value of the ID being posted before the transaction is totally commited to the database.
In order to copy this mechanism, I first tentatively used :
Connection.GetLastAutoGenValue('');
without the fieldname : it returns ID value all the time, _but not the first time it is being use
Then I wised up and tried this :
Connection.GetLastAutoGenValue(mIdFieldName);
But with this, I get an EFDException with message [FireDAC][Phys] -303. Capability is not supported
Is it because I am too soon in the posting process or is there a propriety I need to set ?
Thanks for your help !
Edited by: Maxime Bonin on Aug 28, 2017 10:52 AM
Connect with Us