Thursday, July 3, 2008

SELECTBLOB into picture control

blob lb_pic

SELECTBLOB a.picturecol
INTO :lb_pic
FROM picturetbl a, biodatatbl b
WHERE a.ic = b.ic
AND a.ic = :as_icno using sqlca;

if sqlca.sqlcode = 0 then
   if p_pic.setpicture(lb_pic) = 1 then
      p_pic.visible = True
   else
      p_pic.visible = False
   end if
else
   p_pic.visible = false
end if


/*Above code will select blob from picturetbl and display it on a picture control in Powerbuilder (p_pic)
*/

2 comments:

Unknown said...

How to setpicture i nested datawindow.

i've tried this code but it dosn't work..

Blob lb_pic

SELECTBLOB f620gambar
INTO :lb_pic
FROM t620picture
WHERE f620nopkj = :ls_nopkj
USING sqlca;

IF sqlca.SQLNRows > 0 THEN

dw_report.object.dw_8.object.p_2.visible = true
dw_report.object.dw_8.object.p_2.SetPicture(lb_pic)
ELSE
dw_report.object.dw_8.object.p_2.visible = false
END IF


tq for your help.

Unknown said...

as far as my knowledge :-

picture object in dw only properties is=> dw1.Object.bitmap_1.Filename = "exclaim.bmp"

so u might have to write the blob into local file and point the filename to the path.

or try this...

http://harimada.blogspot.com/2010/04/using-ole-blob-in-powerbuilder-10-using.html