TZAbstractDataset.InternalUpdate Error

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
DerekMcKinnon
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 06.01.2011, 02:28

TZAbstractDataset.InternalUpdate Error

Post by DerekMcKinnon »

Sometimes when I have made a change and then try to save it doesn't save.

The error seems to be in TZAbstractDataset.InternalUpdate on the line.
if (CachedResultSet <> nil) and GetActiveBuffer(RowBuffer) then

This is because CachedResultSet is nil.

I have found the trigger for this problem. In the TZQuery, I have the following code.
procedure TMainChild.QryInvAfterScroll(DataSet: TDataSet);
begin
if QryInv.FieldByName('Date').AsDateTime < stDate then
QryInv.ReadOnly := true
else
QryInv.ReadOnly := false;

end;

The problem occurs when I go to a record that sets the readonly value to true, and then go to a record where the readonly value is set to false. The screen works fine. When it is readonly, the user can't make any changes. When it is not readonly changes can be made.

However when the user tries to save, the CachedResultSet is nil and nothing is saved.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

DerekMcKinnon,
I don't think switching ReadOnly while the query is open is a good idea. Even worse, I sure someone should write the small patch that forbids it.

IF you want to work like that, make sure the query is updatable when you open it. Because it's at that time the decision is taken to make the resultset cached, I think. Otherwise you could also add a check that you only make the query updatable when the cachedresultset exists.

Mark
Image
Locked