BugFix: Cannot convert Null to WideString

renerene Prague, Czech Republic, Europe
edited August 2005 in FastReport 3.0
Hi,
few days ago I decided to write my own modification of TfrxMemoView with Unicode support. Yesterday comes very good news, that FR v3.16 supports Unicode. So I made an upgrade and everything (old functions) seems to be OK, but not the Unicode feature.

Problem: As I am using an Oracle 9i database. when switching OCI session into some 8bit character settings, everything is OK. When switching session into Unicode charset, report is not prepared and exception is raised. This exception is raised in unit frxDBSet.pas by:
function TfrxDBDataset.GetDisplayText(Index: String): WideString;
in section that provides assignment of Value:
{$IFDEF Delphi5}
        if (TField(Fields.Objects[i]) is TWideStringField) then
          s := TField(Fields.Objects[i]).Value
        else
{$ENDIF}

Solution: Bugfix of this problem is in proper retyping:
{$IFDEF Delphi5}
        if (TField(Fields.Objects[i]) is TWideStringField) then
//          s := TField(Fields.Objects[i]).Value // - RM 22.08.2005
          s := TWideStringField(Fields.Objects[i]).Value // + RM 22.08.2005
        else
{$ENDIF}

Now it is working well and all my reports are running with Unicode supports.
Big thanks for this feature and greetings to FR development team.

Rene

PS: I suppose that somebody from FR team will correct me if I made some mistake.

Leave a Comment