當我想通過 FDbatchMove 組件將源表附加到目標表時,Delphi 出現此例外:“[FireDac][Phys][SQLite] ERROR: UNIQUE constraint failed:AG2.M_key。” AG2.M_Key 是我的表的主鍵。如果我可以從 batchmove 中排除主鍵,也許可以解決問題。我怎樣才能做到這一點?
uj5u.com熱心網友回復:
通過這個鱈魚,我可以從 FDbatchmove 追加中排除“m_key”欄位:
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/495041.html
上一篇:將程序分配給動態創建的物件
