//存入
procedure TForm1.Button3Click(Sender: TObject);
var
temp: TMemoryStream;
begin
temp := TMemoryStream.Create;
try
with RichEdit1 do
begin
SelStart := 0;
SelLength := Length(Text);
SelAttributes.Protected := FALSE;
Lines.SaveToStream(temp);
end;
temp.Position := 0;
ADOTable1.open;
ADOTable1.Edit;
TBlobField(ADOTable1.FieldByName('rtf')).LoadFromStream(temp);
ADOTable1.Post;
finally
temp.Free;
end;
end;
//取出
procedure TForm1.Button4Click(Sender: TObject);
var
temp: TMemoryStream;
begin
temp := TMemoryStream.Create;
try
TBlobField(ADOTable1.FieldByName('rtf')).SaveToStream(temp);
temp.Position := 0;
RichEdit1.Lines.LoadFromStream(temp);
finally
temp.Free;
end;
end;
//注:ADO连接