TZAbstractDataset.InternalUpdate Error
Posted: 06.01.2011, 02:39
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.
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.