2004. október 1., péntek

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


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;

Nincsenek megjegyzések:

Megjegyzés küldése