I had to find out how to store RTF formatted text to blob fields, and how to retrieve it, retaining all the formatting. These should be generic enough to put in your function library...
procedure SetRTFTextFromBlobField( dsData: TDataSet; const sField: string; reEdit: TRichEdit );
var
oBS: TBlobStream;
begin
oBS := TBlobStream.Create(dsData.FieldByName(sField) as TBlobField, bmRead);
try
reEdit.Lines.LoadFromStream(oBS);
finally
oBS.Free;
end;
end;
procedure SaveRTFTextToBlobField( dsData: TDataSet; const sField: string; reEdit: TRichEdit );
var
oBS: TBlobStream;
begin
if not (dsData.State in [dsEdit, dsInsert]) then
dsData.Edit;
oBS := TBlobStream.Create(dsData.FieldByName(sField) as TBlobField, bmWrite);
try
reEdit.Lines.SaveToStream(oBS);
dsData.Post;
finally
oBS.Free;
end;
end;