Recordcount not working in datasource.dataset

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Recordcount not working in datasource.dataset

Post by jkuiper » Tue 25 Nov 2008 16:00

I have a baseform with this code

Code: Select all

procedure TBasisFormFld.DataSource1StateChange(Sender: TObject);
begin
  with DataSource1.DataSet do
  begin
    TlBtnNieuw.Enabled := (State in [dsBrowse, dsInactive]);
    TlBtnEdit.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnPost.Enabled := State in [dsInsert, dsEdit];
    TlBtnDelete.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnRecRew.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnRecForward.Enabled := (State = dsBrowse) and (RecordCount > 0);
    TlBtnZoekModus.Enabled := (State in [dsBrowse, dsInactive]);
    TlBtnZoekGevonden.Enabled := (State in [dsBrowse, dsInactive]);
  end;
end;
If I create a new form with the baseform inherited, my datasource checked witch button must me enabled. It works with TMyQuery, but TVirtualTable gives 'recordcount = 0' in this procedure. This is not correct.
I know, because in the childform the recordcount of TVirtualtable shows the correct recordcount.

I'm using TVirtualTable in MyDAC 5.570.0.42 with D2009 pro

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 26 Nov 2008 08:27

Maybe the TVirtualTable component on the inherited form doesn't have records.

jkuiper
Posts: 138
Joined: Fri 04 Aug 2006 14:17

Post by jkuiper » Thu 27 Nov 2008 12:13

But it has. I checked with showmessage() in the baseform and child. The child gives a recordcount, but the baseform gives 0.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 28 Nov 2008 12:41

Probably the VirtualTable component on the base form is not active. Set its Active property to True.

Post Reply