在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);