-------------------------------------------------------------------------------- 我也贴片给你是李维ado书上的 procedure TForm1.Button1Click(Sender: TObject); var sfilename:string; function blobcont(const filename:string):string; begin with tfilestream.Create(filename,fmopenread) do try setlength(result,size); read(pointer(result)^,size); finally free; end; end;
begin if opendialog1.Execute then begin sfilename:=opendialog1.FileName; adodataset1.Append; adodataset1.FieldByName('ff').asstring:=blobcont(sfilename); adodataset1.Post; end; end;
procedure TForm1.Button2Click(Sender: TObject); var sfilename:string; bs:tadoblobstream; begin bs:=tadoblobstream.Create(tblobfield(adodataset1.FieldByName('ff')),bmread); try
sfilename:='c:ff.doc';//换成图片格式就可以了 if fileexists(sfilename) then deletefile(sfilename); bs.SaveTofile(sfilename); OleContainer1.CreateObjectFromFile(sfilename,false); //OleContainer1.LoadFromFile(sfilename); //OleContainer1.LoadFromStream() //memo1.Lines.LoadFromFile(sfilename); // WebBrowser1.Navigate(pchar(sfilename)); finally bs.free; end;