Search code examples
delphidelphi-xe5firedac

Delphi FireDAC and update with FDUpdateSQL class


I have used FDQuery (Delphi XE5 and SQL Server 2008) and set SQL prop to the following SQL command :

select LetterId, LetterTitle, LetterDate
from Letters

and the FDUpdateSQL assigned it to FDQuery.UpdateObject, set FDUpdateSQL.FetchRowSQL to this command :

select LetterTitle
from Letters
where LetterID=:Old_LetterID

When I change the LetterTitle value and post it and then run FDQuery.RefreshRecord, all fields restore with null value and LetterTitle restore with posted value.

Is there a way to restore only the selected field?


Solution

  • Call FDQuery.RefreshRecord(False)

    When the AClearRow parameter is set to True (default value), then the record is initially erased. Otherwise the read values override the corresponding column values.

    FireDAC.Comp.DataSet.TFDDataSet.RefreshRecord