TfrReport.PrepareReport: EInvalidCastException

I have just upgraded from 2.5 to 2.51. I have the fr.inc file set to BDE, and am using the InfoPower IBO components to connect through IBO to an Interbase database.

When I call:
report.LoadFromFile ('filename.frf');
report.PrepareReport;

I get an EInvalidCastException on the line report.PrepareReport.

Anyone know what may be wrong? (Everything was working fine using 2.5!)


Loryn Jenkins

Comments

  • edited 4:59PM
    Could I please have someone from FastReport provide or point me to some processes that could help identify a resolution to this problem?
  • gordkgordk St.Catherines On. Canada.
    edited 4:59PM
    it could be simple like did you make the fr.inc file for 2.51 the same as the one from 2.5?
    or if in d7 turn off invalid cast warning?
    Is there more to the message?
    does it happen running in ide or outside in compiled exe?
    Many possibilities, and most of us can't read your mind, so supply as much info as you can.
    regards ;)
  • edited 4:59PM
    Thank you for your response. You provided me enough hints for me to actually figure out a workaround (for now).

    Anway, for the sake of documenting the issue, here is what was occurring:

    When I ran the code from within the debugger, I would get this message:
    Debugger Exception Notification

    Project Test.exe raised exception class EInvalidCast with message 'Invalid class typecast'. Process stopped. Use Step or Run to continue.

    The breakpoint was set on this line:

    class FR_Class

    procedure CreateDS
    ...
    DataSet := frFindComponent(CurReport.Owner, Desc) as TfrDataSet;

    And when tracing it down the call stack, the actual exception was being thrown on this line:

    class FR_Utils

    procedure FrFindComponent
    ...
    Result := Owner.FindComponent(Name)

    Now, the type of the component was a TwwDataSource. I was linking my TfrDBDataSet to the TwwDataSource rather than directly linking it to the TwwIBOQuery.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.