ZMemtable, How to create a dataset and findkey?
Posted: 21.07.2023, 14:59
Hi All,
I´am trying to use zMemtable as Delphi Client Dataset, but it´s my first time with Zeos 8 Memtable, how Can I Create a dataset in runtime memory, create index and find key fields? I create this sample, but something is wrong, can you help me? Follow:
// sample
zMemTable1.FilterOptions:=[foCaseInsensitive];
zMemTable1.FieldDefs.Clear;
zMemTable1.FieldDefs.Add('status', ftString, 3, False);
zMemTable1.FieldDefs.Add('seq', ftInteger, 0, False);
zMemTable1.FieldDefs.Add('filename', ftString, 1024, False);
zMemTable1.FieldDefs.Add('filepath', ftString, 1024, False);
zMemTable1.CreateDataSet; // not exists CreateDataSet ?
zMemTable1.Active:=true;
zMemTable1.IndexFieldNames:='filename;filepath'; // is it right to use two fields?
if not zMemTable1.FindKey(['arq.exe', 'c:\temp']) then // there is no FindKey?
begin
// not found ...
end;
In this sample does not exists zMemTable1.CreateDataSet, can I continue without that?
In this sample I use zMemTable1.IndexFieldNames:='filename;filepath' to create a index with two fields, is it right?
In this sample I try to find a record with two values accord with IndexFieldNames zMemTable1.FindKey(['arq.exe', 'c:\temp']), but there is not FindKey method, how to find them?
Any hjelp will be welcome.
I´am trying to use zMemtable as Delphi Client Dataset, but it´s my first time with Zeos 8 Memtable, how Can I Create a dataset in runtime memory, create index and find key fields? I create this sample, but something is wrong, can you help me? Follow:
// sample
zMemTable1.FilterOptions:=[foCaseInsensitive];
zMemTable1.FieldDefs.Clear;
zMemTable1.FieldDefs.Add('status', ftString, 3, False);
zMemTable1.FieldDefs.Add('seq', ftInteger, 0, False);
zMemTable1.FieldDefs.Add('filename', ftString, 1024, False);
zMemTable1.FieldDefs.Add('filepath', ftString, 1024, False);
zMemTable1.CreateDataSet; // not exists CreateDataSet ?
zMemTable1.Active:=true;
zMemTable1.IndexFieldNames:='filename;filepath'; // is it right to use two fields?
if not zMemTable1.FindKey(['arq.exe', 'c:\temp']) then // there is no FindKey?
begin
// not found ...
end;
In this sample does not exists zMemTable1.CreateDataSet, can I continue without that?
In this sample I use zMemTable1.IndexFieldNames:='filename;filepath' to create a index with two fields, is it right?
In this sample I try to find a record with two values accord with IndexFieldNames zMemTable1.FindKey(['arq.exe', 'c:\temp']), but there is not FindKey method, how to find them?
Any hjelp will be welcome.