bmp:
保存:
var
CurStream:TFileStream;
begin
Table1.append;
if FileName<>'' then
begin
CurStream:=TFileStream.Create(FileName,fmOpenRead);
TBlobField(Table1.FieldByName('ole object Field')).LoadFromStream(CurStream);
CurStream.free;
end;
Table1.post;
取出:
TBlobField(Table1.FieldByName('ole object Field')).SavetoFile('c:/temp.bmp');
shellExecute(handle,'open','c:/temp.bmp', '', '', SW_SHOWNORMAL);
jpg:
保存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,soFrombegin
ning);
jpeg.loadfromstream(stream);
image.Picture.Bitmap.Assign(jpeg);
jpeg.Free;
stream.Free;
end
else
image.Picture:=nil;
end;