When I want append source table to destination table by FDbatchMove component , Delphi rise this exception: "[FireDac][Phys][SQLite] ERROR: UNIQUE constraint failed:AG2.M_key." AG2.M_Key is primary key of my Table. If I can exclude primary key from batchmove, maybe can solve problem. How can I do that?
CodePudding user response:
By this cod i can exclude 'm_key' field from FDbatchmove append:
var ind:integer;
begin
FDBatchMove1.Mappings.Clear;
FDBatchMove1.Mappings.AddAll;
ind:=FDBatchMove1.Mappings.IndexOfName('m_key');
if ind<>-1 then
FDBatchMove1.Mappings.Delete(ind);
FDBatchMove1.Execute;
end