I have a problem changing the record - Edit.
procedure TfrmUser.dbdysrc1FieldsToItem(Sender: TObject; Fields: TFields; Item: TPlannerItem);
begin
if not Fields.FieldByName('COLOR').IsNull then
begin
Item.Color := TColor(Fields.FieldByName('COLOR').AsInteger);
Item.CaptionBkg := Item.Color;
Item.DBKey := Fields.FieldByName('IDPLANNERS').AsString;
end;
end;
procedure TfrmUser.dbdysrc1ItemToFields(Sender: TObject; Fields: TFields; Item: TPlannerItem);
begin
fdtblPlanner.UpdateTransaction.StartTransaction;
Fields.FieldByName('IDPLANNERS').AsInteger := StrToInt(Item.DBKey); // The value is OK
Fields.FieldByName('COLOR').AsInteger := Integer(Item.Color); // The value is OK
end;
Project Pokusy.exe raised exception class EFDDBEngineException with message '[FireDAC][Phys][FB]-312. Exact update affected [0] rows, while [1] was requested'.
[FireDAC][DApt]-400. Update command updated [0] instead of [1] record. Possible reasons: update table does not have PK or row identifier, record has been changed/deleted by another user.
I don't know where to end the transaction - Commit. Nothing is auto.
All your examples are done with Access (DB, DBF). He doesn't know the transactions. It would be useful to do examples with FireDAC + transactions.
I can solve the problem using SQL, but it's unnecessary extra work.