sinat_31804145
sinat_31804145
2017-07-17 02:59

delphi 从库里取出IMAGE图片数据做分页显示,内存报错,请教大侠如何处理?

  • delphi

问题如题,以下为代码:
procedure TFrmCaipuManage.Page_Count;
var
i:integer;
ListItem:TListItem;
Stream:TMemoryStream;
Jpg:TjpegImage;
begin
ListView1.Clear;
with adolist do
begin
sql.Clear;
sql.Add('select * from Tb_Caipu ');
open;
RecSum:=RecordCount;
if Page = 0 then Page := 1;
if Page > RecordSet.RecordCount then page := RecordSet.RecordCount;
Recordset.PageSize := 12;
RecordSet.AbsolutePage := Page;
for i:= 1 to Recordset.PageSize do
begin
ListItem := ListView1.Items.Add;
ListItem.SubItems.Add(RecordSet.Fields.Item[0].value);
ListItem.SubItems.Add(RecordSet.Fields.Item[1].Value);
TBlobField(RecordSet.Fields.Item[3]).SaveToStream(Stream);//<<<-------此行报错!!!!!
Stream.Position :=0;
jpg.LoadFromStream(Stream); // 加载图片
imgPhoto.Picture.Assign(Jpg);
Next;
if RecordSet.EOF then exit;
end;
end;
end;

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答