Mirror

How to store an RTF text in a database blob field without using a TDBRichEdit (Views: 100)


Problem/Question/Abstract:

How to store an RTF text in a database blob field without using a TDBRichEdit

Answer:

{ ... }
var
  blobS: TBlobStream;
begin
  blobS := TBlobStream.Create(TBlobField(table1.FieldByName('YourField')), bmWrite);
  try
    table1.Edit;
    try
      RichEdit1.Lines.SaveToStream(blobS);
      table1.Post;
    except
      table1.Cancel;
      raise;
    end;
  finally
    blobS.Free;
  end;
end;

<< Back to main page