这样做,我这段代码是保存JPG文件到access库的ole字段中的。
procedure Tfrmado.ImageDblClick(Sender: TObject);
begin
with topendialog.Create(Self) do
begin
if execute then
begin
if not (adoquery1.State in [dsedit]) then adoquery1.Edit ;
tblobfield(adoquery1.FieldByName('jpg')).LoadFromFile(FileName) ;
end;
end;
end;
procedure Tfrmado.DataSource1DataChange(Sender: TObject; Field: TField);
var
jpeg:tjpegimage;
stream :TMemoryStream;
begin
if adoquery1jpg.BlobSize>0 then
begin
jpeg:=tjpegimage.Create;
stream :=TMemoryStream.Create;
tblobfield(adoquery1.FieldByName('jpg')).savetostream(stream);
Stream.Seek(0,soFromBeginning);
jpeg.loadfromstream(stream);
image.Picture.Bitmap.Assign(jpeg);
jpeg.Free;
stream.Free;
end
else
image.Picture:=nil;
end;