Board index » cppbuilder » +++ TClientDataSet in Multi-User-Environment +++

+++ TClientDataSet in Multi-User-Environment +++


2004-09-13 03:22:47 PM
cppbuilder58
I use a ClientDataSet to show a table opened with ADOTable
an VFPOLEDB.
The ClientDataset works fine as single user.
When i change a record (for example with VisualFoxPro
development environment) and a few secondes later try to
change the same record in the ClientDataSet i get two
exceptions (see the code below)
The first exception is necessary, as the record is changed
by another user like it says.
So the real problem is: Directly after the first exception
the second exception appears - the code in the catch part
is NEVER executed, so it is NOT possible to solve the
problem (for example to refresh the shown data or only
that record ...)
Is this a common problem with ClientDataSets ?
How to solve it ?
Lutz
===============================================================
void __fastcall TFormDBF::cdsAfterPost(TDataSet *DataSet)
{
int iErrors ;
// ClientDataSet writes changes with ApplyUpdates()
try
{
// ApplyUpdates() makes Exception if another user
// has changed data in the meantime
// o EDatabaseError: Record not found or changed by another user
// followed by ...
// o EDatabaseError: Record not found, no key / index known
iErrors = cdsDbf->ApplyUpdates(0) ;
}
catch(Exception &ex)
{
// CATCH is NEVER executed
...
}
}
===============================================================
 
 

Re:+++ TClientDataSet in Multi-User-Environment +++

Try catching any exception:
catch(...)
{
...
}
}