I'm using the TUniQuery component from UniDAC. I'd like to show how many records I have, so
I've put the following code to show in a Status Bar:
procedure TForm1.unyQuery1AfterFetch(DataSet: TCustomDADataSet);
begin
StatusBar1.Panels[1].Text := 'NĂºmero de registros: ' + inttostr(unyQuery1.RecordCount);
end;
UnyQuery1.RecordCount always returns zero. But if I run this code from a button click event it works.
What I'm doing wrong?
Use the AfterOpen event of the Query and not AfterFetch.
also from devart:
For the mapping of the data-getting process in ClientDataSet you should set the ClientDataSet.PacketRecord property equal to UniQuery.FetchRows and use the ClientDataSet.GetData event for the mapping of the data-getting process