I used EmptyDataSet because I supposed that is the right method for doing my chance but it seems not works correctly.
I wish delete all records presents on DetailDataset then repopulate it with a new data with a possibility of cancel those updates. New data can contain old keys or not.
This is my code:
Code: Select all
DetailDataset.EmptyDataset;
for Indice := 0 to (Lista.Count - 1) do
begin
DetailDataset.AppendRecord([ID, Lista.Strings[Indice]);
end;
CachedUpdates setting is:
For DetailDataset = True
For MasterDataset = False
When I post MasterDataset I receive the error: Violation of PRIMARY or UNIQUE KEY constraint "DetailDataset_PK" on table "DetailDataset" Problematic key values is "Master_ID = 83", Detail_ID = "22" ... no 2 table rows can have duplicate column values.
if I substitute DetailDataset.EmptyDataset with this code, all works I desired:
Code: Select all
while not DetailDataSet.Eof do
DetailDataSet.Delete;
Thanks