在access中建一个备注字段,名为binary。
主键id。
有一timage已装载的图片。memstream为tmemorystream;p为byte
存:
self.Image1.Picture.Bitmap.SaveToStream(memstream);
memstream.seek(0,soFromBeginning );
while memstream.Position<memstream.Size do
begin
memstream.ReadBuffer(p,1);
i:=length(inttostr(p));
self.ADODataSet1.Recordset.Fields[1].AppendChunk(inttostr(i)+inttostr(p));
end;
self.ADODataSet1.Recordset.UpdateBatch(1);
取:
with self.ADODataSet1 do
begin
while i< recordset.Fields[1].ActualSize do
begin
l:=strtoint(recordset.Fields[1].GetChunk(1));
m:=recordset.Fields[1].GetChunk(l);
i:=i+2*l+2;
try
b:=strtoint(m);
memstream.Write(b,1);
except
begin
showmessage(inttostr(l));
end;
end;
end;
end;
memstream.Seek(0,soFromBeginning);
self.Image1.Picture.Bitmap.LoadFromStream(memstream);
本文地址:http://com.8s8s.com/it/it4451.htm