When calling Post on a TFDQuery, I get this error:
[FireDAC][Phys][MSSQL]-312 Exact update affected [5] rows, while [1] was requested
Normally this check is very useful to warn that you have probably done something wrong, but in this case I want to update more than one record for every row on the TFDQuery. Is there a way to disable the count checking for a FDQuery Posts ?.
I'm trying setting UpdateOptions.CountUpdateRecords to false, but it still raises the error.
The code is something like:
q1:=TAEFDQuery.Create(Self);
q1.UpdateOptions.CountUpdatedRecords := False; // I try to disable the count check
q1.Connection:=Fprincipal.dades;
q1.SQL.Text:=' SELECT NumeroOrdre,' +
' Palet,' +
' tipusPalets,' +
' numPaletFabricacio' +
' FROM DistribucioPalets' +
' WHERE NumeroOrdre = ' + Ordre.ToString
q1.Open;
q1.Edit;
q1.FieldByName('numPaletFabricacio').AsInteger:=numPaletFabricacio;
q1.Post;
PS: I know that I can easily replace it with an UPDATE command, but this is a program that I have ported from ADO to FireDAC and has plenty of similar queries, so I would like to see first if there are configuration properties that can set the FireDAC queries to behave similarly to how the original ADO queries did.
Thank you
As Brian mentions, in the TFDTable (Or TFDQuery) among the properties, opening the UpdateOptions branch, you find the property CountUpdatedRecords, that does avoid the error message, I keep on having problems as updates fired by another update get all mixed up, but no error message.
You can also modify this property in the connection properties (In the same TFDQuery or TFDTable properies Object Inspector), opening the branches for Connection --> Update Options --> CountUpdatedRecords and set it to false. But if you do so on the Connection, you will be changing this property for all the TFDQuery/TFDTable using that connection.
I was having the same problem, meaning, while updating one record in a TFDQuery I do update other records affected by this update in the same data-source, and got this error message that disappeared by setting this property to False. The update is being done wrongly, but I get no error message anymore.