"Update failed" on paradox cached update
I am converting my application from using TTable object to TQuery and
TUpdateSQL objects. I use the TDatabase object in a data module form.
I have several unrelated tables that I reference and update.
I did not have any problem when I converted the first table to a
query/update SQL pair. However, with the second and third tables, I get an
"update failed" error when I run the TQuery.ApplyUpdates method. As you can
see below, this is in a try...except construct. However, when this fails,
it does not appear to be executing the except part of the construct.
Help!!!
I have tried having seperate routines for each query object, I have tried
embedding them in the same transaction, nothing works. Am I limited to one
TQuery/TUpdateSQL object per TDatabase object? This does not make sense.
Perhaps I need to do something after CommitUpdates. However, I use this
same technique in other programs with multiple TQuery per TDatabase without
problems.
Help and guidence is greatly appreciated.
- Rich
//************************
procedure tfrmMain.ApplyCachedUpdates(TargetQuery: TQuery);
begin
dmMain.dbPrivate.StartTransaction;
try
TargetQuery.ApplyUpdates; // Succeeds on first query, fails on
second here.
dmMain.dbPrivate.Commit;
except
dmMain.dbPrivate.Rollback;
raise;
end;
TargetQuery.CommitUpdates;
end;
//*************