'GetCalcFields' not found in base class Error

type
  TCDSWithRecalc = class(TClientDataset)
  public
    procedure GetCalcFields(Buffer: PChar); override;
  end;

procedure TCDSWithRecalc.GetCalcFields(Buffer :PChar);
begin
  inherited GetCalcFields(Buffer);
end;

E2137 Method 'GetCalcFields' not found in base class.

I don't understand what this error is. can you help?


Solution 1:

You don't say which Delphi version you are using, but the type declaration of the Buffer parameter was changed from the original (D7 and before) PChar to TRecBuf in the modern (Unicode) versions. So, you you need to change your declaration of TCDSWithRecalc

to

type
  TCDSWithRecalc = class(TCustomClientDataset)
  public
    procedure GetCalcFields(Buffer: TRecBuf); override;
  end;

[...]

procedure TCDSWithRecalc.GetCalcFields(Buffer : TRecBuf);
begin
  inherited GetCalcFields(Buffer);
end;

In Delphi 10.4.2, the compiler reports an additional error with your version of the declaration

[dcc32 Error] cds1u.pas(41): E2250 There is no overloaded version of 'GetCalcFields' that can be called with these arguments

which is true.