DBAdvRichEditor not posting changes back to table

I'm using a DBAdvRichEditor component to edit a Word rtf document stored in a MS-SQL 2012 table (Field Type varbinary(max))

I set datasource and filename properties in AdvRichEditorRTFIO component and connect it to DBAdvRichEditor  (resolving error Invalid stream format). The document displays correctly and I can edit the content, but the document in the table stays unchanged.
Te demo uses Access database and field type OLE so I can't use it as is.
What is the correct way to use these components with a SQL table?
Best Regards
Francisco Alvarado

If you want to persist the content of a TAdvRichEditor as RTF text in a DB field, you need to use TDBAdvRichEditorRTFIO connected to a TAdvRichEditor and set the DataSource, DataField on TDBAdvRichEditorRTFIO. When you use TDBAdvRichEditor, it will persist in the DB field as binary data, so a binary blob is needed and not TAdvRichEditorRTFIO is needed.

Hi Bruno!

I'm not sure I get the solution... I'm loading a rtf file to a MS-SQL field of type varbinary(max)

var
  Blob, fs : TStream;
begin

    blob := FDQuery1.CreateBlobStream(FDQuery1.FieldByName('Document'), bmWrite);
    try
      blob.Seek(0, soFromBeginning);
      fs := TFileStream.Create(eFileName.Text, fmOpenRead or fmShareDenyWrite);
      try
        blob.CopyFrom(fs, fs.Size);
      finally
        fs.Free
      end;
    finally
      blob.Free
    end;
end;

In the form to edit, I set DataSource and FieldName properties in a TDBAdvRichEditorRTFIO component connected to a TDBAdvRichEditor because if I only use a TDBAdvRichEditor editor I receive Invalid stream format error.
Can you post some seudo-code to explain your solution? 
Best Regards
Francisco Alvarado

I'm not sure why you do this blob manipulation yourself. TDBAdvRichEditorRTFIO handles this all internally. 
A sample can be downloaded here: http://www.tmssoftware.net/public/DBAdvRichEditorRTFIODemo.zip

Bruno:
I'm sorry, I didn't explain myself clearly.
The code is for uploading a MS Word file type RTF to a MS-SQL Server table with a field type of varbinary(max). This is a template-questionnaire used to fill some information for an event. The template contains some questions to be answered. When a event occurs, a new record is created and this questionnaire is uploaded, along with some pertinent information to be filled by the user and saved in the table. Later, the answered questionnaires are reviewed, edited again if some information is missing, updated in the table and printed by the administrator.

So I need to load this template-questionnaire in a field, answered by te user and stored in a table.

I hope my need is explained and how the included example is not working.
Best Regards
Francisco Alvarado

I understand you initialize the DB field from an external created RTF file.

But how does this then related to T(DB)AdvRichEditor, TDBdvRIchEditorRTFIO?
Once the RTF is loaded into the DB field and TDBAdvRIchEditorRTFIO connects to this DB field, the connected TAdvRichEditor should display the RTF.

Hi Bruno!

As I said in my initial post it displays correctly and I can edit it, but the changes I made don't persist on the table...
I had a minor surgery yesterday and I didn't read your response until now, I'll try another approach or solution to see if I can resolve it.
Best Regards
Francisco Alvarado

Do you post from the DB navigator?