2801:Getting a query's Memo field as a string
KEYWORDS: Memo Query String AREA: Database Programming
Returning a Memo value to an Edit field without
using a memo field.
Place a query object on your form (Query1)
Place a Edit object on your form (Edit1)
Place a Button object on your form (Button1)
Double-Click on the query and add the memo field.
(Biolife.db using notes field)
Set Query1's SQL property to: Select * from Biolife
Set Query1's Active property to: True
Add the following code to Button1's OnClick event:
procedure TForm1.Button1Click(Sender: TObject);
var
bs : TBlobStream;
p : array [0..50] of char;
begin
FillChar(p, SizeOf(p), #0);
bs:= TBlobStream.Create(Query1Notes, bmRead);
try
bs.Read(p,50);
finally
bs.Free;
end;
Edit1.Text:=StrPas(p);
end;
TI