Page 1 of 1

ZMemTable ?

Posted: 12.07.2024, 16:18
by hffranzin1
How does ZMenTable work?

I didn't find any documentation about it...

Thanks

Re: ZMemTable ?

Posted: 13.07.2024, 13:33
by aehimself
ZMemTable works like a ClientDataSet or any other memory dataset should:

- You create FieldDefs (ZMemTable.FieldDefs.Add)
- You open the dataset (ZMemTable.Open)
- Add, remove, manipulate data as usual (ZMemTable.FieldByName, ZMemTable.Filter, ZMemTable.Next, etc)
- Close the dataset (ZMemTable.Close)

Is this enough to keep you started? If no, please ask something more exact - vague question usually results a vague answer.

Re: ZMemTable ?

Posted: 13.07.2024, 15:41
by miab3
and:

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
begin
  ZMemTable1.Close;
  ZMemTable1.FieldDefs.Clear;;
  ZMemTable1.AssignDataFrom(ZQuery2);
end;

procedure TForm1.Button2Click(Sender: TObject);
var fs: TFileStream;
begin
  fs := TFileStream.Create('t2code.bin', fmCreate);
  Try
    ZMemTable1.SaveToStream(fs);
  Finally
    fs.Free;
  End;
end;

procedure TForm1.Button3Click(Sender: TObject);
var fs: TFileStream;
begin
  ZMemTable1.Close;
  ZMemTable1.FieldDefs.Clear;
  fs := TFileStream.Create('t2code.bin', fmOpenRead);
  Try
    ZMemTable1.LoadFromStream(fs);
  Finally
    fs.Free;
  End;
end;
Michal

Re: ZMemTable ?

Posted: 14.07.2024, 01:33
by hffranzin1
Thank you very much, that's exactly what I wanted to know, how to load data from a query to Zmemtable