Association of a ClientDataSet and a TZQuery (ZeosLib)

2

I have a question about the association of ClientDataSet and TZQuery . I wanted to associate the same table that I selected in my TZQuery , with my ClientDataSet , because I want to generate a .XML file from the table my ClientDataSet got. >

At first I thought it was like this:

ClientDataSet1.Assign(ZQuery1);

or

ClientDataSet1.Data := ZQuery1

Give an error of different types.

But obviously I was wrong.

Any ideas?

    
asked by anonymous 03.06.2014 / 14:44

2 answers

1

You can connect to DataSetProvider and open ClientDataSet instead of ZQuery .

Example:

procedure TMainForm.ObterDados;       
begin
  DataSetProvider.DataSet := ZQuery1;
  ClientDataSet1.SetProvider(DataSetProvider1);
  ClientDataSet1.Open;
end;

The DataSetProvider is in the Data Access palette, the same as ClientDataSet .

    
03.06.2014 / 14:56
3
DModuleGrid.ZQuery2.Close;
DModuleGrid.ZQuery2.SQL.Clear;
DModuleGrid.ZQuery2.SQL.Add('SELECT * FROM tabc460 LIMIT 0, '+IntToStr(treg));
DModuleGrid.ZQuery2.Open;
DModuleGrid.ClientDataSet1.Open;

It worked with the exact query, it listed all the data in my .xml file.

    
03.06.2014 / 15:47