SaveToStreamer

  • 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
    1. Var
    2. P: TMemoryStream;
    3. begin
    4. P := TMemoryStream.Create;
    5. TWPRichText1.SaveToStream(P);
    6. end

    And to save in my bank:

    Code
    1. with DM.SQL_Temp do
    2. begin
    3. SQL.Add('INSERT INTO TABLE (FIELD1, FIELD2) VALUES (:FIELD1, :FIELD2)');
    4. ParamByName('FIELD1').LoadFromStream(P, ftBlob);
    5. ParamByName('FIELD2').AsInteger := FIELD2;
    6. ExecSQL;
    7. 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?

  • 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.