>> The problem is, after post, applyupdates and savepointrollback, the
>> state of dataset is dsbrowse, than I should call dataset.edit to edit
>> to fix the errors. After I save again, data didn't store in database
>> because SQL to be "UPDATE table..." and not "INSERT INTO table...".
>>
> There seems something wrong, update kind should not change from ukInsert to
> ukModify by editing an inserted record. Are you sure?
>

The summary of my code like this :
procedure saverecord;
begin
try
  transaction.savepointbegin;
  dataset1.append;
  ...
  ...
  dataset1.post;
  dataset2.append;
  ...
  ...
  dataset2.post;
  dataset1.applyupdates;
  >>>>>error from server
  dataset2.applyupdates;
  ...
  transaction.commitretaining;
except
  transaction.savepointrollback;
  >>>>>caused by dataset1 and dataset2 state is set to dsbrowse, than
I do dataset.edit
  dataset1.edit;
end;
end;

The dataset1 and dataset2 buffer don't remove than I can fix error of
data input, I call saverecord again.
And I got other error from server because dataset1 execute SQL "UPDATE
dataset1 ..WHERE key1=...." and not "INSERT INTO dataset1...", so
dataset1 still empty (could not update cause server can not found key1
of dataset1. The second error come from dataset2.applyupdates caused
by dataset2 have foreign key to dataset1.

The conclusion :
Is possible to make dataset1.state still in dsInsert after
savepointrollback, because after savepointrollback dataset1.buffer
still exists?

Thanks
_______________________________________________
MSEide-MSEgui-talk mailing list
MSEide-MSEgui-talk@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/mseide-msegui-talk

Reply via email to