不一样,同一段代码,可是只能存去bmp文件,代码如下:
存入的代码:
procedure TForm1.Button1Click(Sender: TObject);
var
sql:string;
stream:TMemoryStream;
begin
stream:=Tmemorystream.create;
image1.Picture.Graphic.SaveToStream(stream);
stream.position:=0;
showmessage(inttostr(stream.Size));
IBTable1.Open;
IBTable1.edit;
TBlobField(IBTable1.FieldbyName('serials')).LoadFromStream(stream);
IBTable1.Post; //serials为存放字段
stream.free;
end;
取出的代码:
procedure TForm1.Button2Click(Sender: TObject);
var
Stream:TMemoryStream;
begin
Stream:=TMemoryStream.Create;
Stream.LoadFromStream(IBTable1.CreateBlobStream(IBTable1.FieldByName('serials'),bmRead));
image2.Picture.Graphic.LoadFromStream(stream);
Stream.Free;
end;