Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
ZMemTable1.FieldDefs.Add('ID', ftLargeInt, 0, True);
ZMemTable1.FieldDefs.Add('Text', ftWideString, 100, True);
ZMemTable1.Open;
ZMemTable1.Append;
ZMemTable1.FieldByName('ID').AsLargeInt := ZMemTable1.RecordCount + 1;
ZMemTable1.Post;
end;
I used a ZMemTable to display a data structure in a heavily customized DBGrid, so it really doesn't matter for me. However, this should be looked at in the future. A quick debug in .Post reveals absolutely zero checks on required fields whatsoever; maybe because TZVirtualResultSet.PostRowUpdates is empty. I admit I was a bit lazy to check where the exception is raised with TZQuery.
Using D11.1 patch 1 but I suspect a check is missing in Zeos's code so it shouldn't matter.