Author: Tomas Rutkauskas
I would like to read the lines from a memo field into my program using
FieldByName().As. There does not seem to be any way to move the memo into a TString
or TStringList or to access the memo field on a line by line basis. You can use a
String or Variant. When you do this you get just one long composite string. Can you
help?
Answer:
Almost every TStrings descendant has a LoadFromStream method:
1 2 procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
3 var4 TB: TBlobStream;
5 begin6 with TDataSource(Sender).DataSet do7 if (State = dsBrowse) then8 begin9 TB := TBlobStream.create(FieldByName('Event_Description') as TBlobField,
10 bmRead);
11 Memo1.Lines.LoadFromStream(TB);
12 {or ListBox1.items.LoadFromStream(TB);}13 {or StringList1.LoadFromStream(TB);}14 TB.Free;
15 end;
16 end;