我的代碼:
adobase.Close;
adobase.SQL.Clear;
adobase.SQL.Text:='select carimg.*,cartb.cno from carimg inner join cartb on carimg.ipid=cartb.cno where carimg.ipid='''+edt_cno.Text+''' ';
adobase.Open;
if adobase.RecordCount>0 then
begin
if not adobase.fieldbyname('oleimg').IsNull then
begin
stream:=TmemoryStream.Create;
tblobfield(adobase.fieldbyname('oleimg')).SaveToStream(stream);
stream.Position:=0;
Graphic:=tjpegimage.Create;
Graphic.LoadFromStream(stream);
image1.Picture.Assign(Graphic);
stream.Free;
Graphic.Free;
end
else
begin
image1.Picture:=nil;
end;
end;