• Hello Everyone!

    I use WPTOOLS 8 in Delphi Berlin and i have an application to which i get the contents of a TWPRichText and saved in a blob field in my database. To do this, i use the following code:

    Code
    Var
      P: TMemoryStream;
    begin
      P := TMemoryStream.Create;
      TWPRichText1.SaveToStream(P);
    end

    And to save in my bank:

    Code
    with DM.SQL_Temp do
          begin
            SQL.Add('INSERT INTO TABLE (FIELD1, FIELD2) VALUES (:FIELD1, :FIELD2)');
            ParamByName('FIELD1').LoadFromStream(P, ftBlob);
            ParamByName('FIELD2').AsInteger := FIELD2;
            ExecSQL;
          end;

    What happens is that my computer works right, saving right. On the custumer machine, the blob field is left blank. How can this be? On my computer it works right and not on the custumer?

    I tested it on several computers and only on my works. Nowhere else has it worked. The record is created right, but the field where it should be is the RTF is null!

    I do not know what to do anymore!

    Does anyone have any ideas for helping me?

    • Offizieller Beitrag

    I would expect that has to do with the codepage setting of the database.

    WPRichText.SaveToStream will always create a ASCII based RTF stream. Such a stream should not be saved to a field which expects unicodes or does nay kind of code page conversion.

    LoadFromStream sometimes requires a Stream.Position := 0 before the execution.

    When you say the RTF is null - is it really empty? Please save your blob for debug purposes to a file and check what in that file.