Page 1 of 1

ApplyUpdates Errors Calling ClentDataset Refresh

Posted: Thu 02 Aug 2012 13:23
by mmalinow
Hello,

You may want to disregard. It appears Refresh works fine. I just have a situation where the Change Count <> 0 when it is called. Causing an ApplyUpdates Before Refresh exception.

I am involved in maintaining a Delphi application originally written in Delphi 3 and using the BDE to acsess Oracle. Within the past 2 years we have migrated the code to Delphi 2010 and implemented the dbExpress driver for Oracle. We have seen some problems when calling ClientDatset.Refresh. In all cases our CDSs are and have been populated through TSQLStoredProcedure calls. We do DB updates by calling other package calls to Modify, Add etc. I am thinking that calls to CDS.Refresh are inappropriate based on how we are not directly connected to the DB through the CDS providers. What is your opinion?

Thank you,
Mike Malinowski
PRG

Re: ApplyUpdates Errors Calling ClentDataset Refresh

Posted: Fri 03 Aug 2012 10:23
by AlexP
hello,

When attempting to update an edited CDS before calling the ApplyUpdates method, an error occurs in the InternalRefresh standard method, since ChangeCount >0.
And since you are using stored procedures for retrieving data, you won't be able to call the ApplyUpdate method for this CDS, and update the edited CDS as well.

procedure TCustomClientDataSet.InternalRefresh;
...
if ChangeCount > 0 then <- True
DatabaseError(SRefreshError, Self); <- Error