K
kscitic
Unregistered / Unconfirmed
GUEST, unregistred user!
我在用流操作数据的时候出现“JPEG Error #52 "或“JPEG Error #42"
我的代码如下:
procedure TForm1.DBGrid1DblClick(Sender: TObject);
var
jpeg:tjpegimage;
stream :TMemoryStream;
begin
if TBlobField(table1.FieldByName('image')).BlobSize>0 then
begin
jpeg:=tjpegimage.Create;
stream :=TMemoryStream.Create;
tblobfield(table1.FieldByName('image')).savetostream(stream);
Stream.Seek(0,soFromBeginning);
table1.edit ;
jpeg.loadfromstream(stream);
image2.Picture.Bitmap.Assign(jpeg);
jpeg.Free;
stream.Free;
end
else
image2.Picture:=nil;
end;
end.
我的代码如下:
procedure TForm1.DBGrid1DblClick(Sender: TObject);
var
jpeg:tjpegimage;
stream :TMemoryStream;
begin
if TBlobField(table1.FieldByName('image')).BlobSize>0 then
begin
jpeg:=tjpegimage.Create;
stream :=TMemoryStream.Create;
tblobfield(table1.FieldByName('image')).savetostream(stream);
Stream.Seek(0,soFromBeginning);
table1.edit ;
jpeg.loadfromstream(stream);
image2.Picture.Bitmap.Assign(jpeg);
jpeg.Free;
stream.Free;
end
else
image2.Picture:=nil;
end;
end.