Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Dataset loses its cursor position when posting : InternalPost


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Jul 17, 2017 9:43 PM Last Post By: Dmitry Arefiev
Maxime Bonin

Posts: 61
Registered: 1/23/17
Dataset loses its cursor position when posting : InternalPost  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2017 10:54 AM
I use Delphi XE8, FireDAC connected to a Microsoft SQL Express 2014 database

Hello all,

I have an issue with the InternalPost method of TDataSet.Post in FireDAC connected to MSSQL.

I have overridden the 'InternalPost' method on my customized Query : while posting a new record to a table, I add a log to another table.

The problem is the Dataset being inserted into looses its record position in the InternalPost method (CheckOperation(InternalPost, FonPostError) of TDataSet.Post). Hence, I cannot rely on the data of the record being posted to fill my log table.

As a quickfix, I have overriden the InternalPost of my custom TFDQueryDataset(which inherits from TFDQuery) : in it I do

  if ( (State = dsInsert) and (Name = 'the_problematic_table') ) then
     Resync([]); 


It works for the log purpose, but when the post process is done. The cursor of the TDBGrid displaying 'the_ Problemematic_table' is not positionned on the newly inserted record but on a random one.

thank you in advance for your inputs
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Dataset loses its cursor position when posting : InternalPost  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2017 9:43 PM   in response to: Maxime Bonin in response to: Maxime Bonin
Try to override DoAfterPost method.

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02