Association of a Clientdataset and a Tzquery (Zeoslib)

Asked

Viewed 821 times

2

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

At first, I thought it was like this:

ClientDataSet1.Assign(ZQuery1);

or

ClientDataSet1.Data := ZQuery1

Gives a mistake of different types.

But obviously I was wrong.

Any idea?

2 answers

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 file . xml.

  • 2

    @Tremdoido, truth, would be opening the same query 2 times. : S

1


You can make the connection with DataSetProvider and open the ClientDataSet instead of ZQuery.

Example:

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

The Datasetprovider is in the palette Data Access, the same of ClientDataSet.

  • 1

    He managed to get a record only, which could be?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.