We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Ole images powerbuilder 10

Medium Priority
Last Modified: 2013-12-26
Dear Experts ;

I need help related to ole objects in powerbuilder, i want to load an image from my hard drive into an ole control ( from an open dialog box ) and then save that image in the database. I was able to make the code for saving and it works, also i was able to make the code for showing the image with SelectBlob from the database, BUT my PROBLEM is that i cannot load the image in the ole OBJECT from my hard drive, so i only save and show empty images in the ole.
I also try to load the image from the hard disk in a picture control, it worked but when a save , it saves an empty image.
Please help with the code for loading an image to ole object from hardrive.
Watch Question


this is a very nice sample code posted by one of our experts for a similar post...

// Retrieves picture from database
 selectblob emp_pic
  into :b_pic
  from erpp_employee_info
  where last_name = :is_lname
  and first_name = :is_fname
  and sect_assign = :is_section;

 //As long as there was a picture
 if (SQLCA.SQLCode = 0 AND NOT isNull(b_pic)) then

  // Get the file length
  ll_file_len = Len(b_pic)

   // Determines what blank picture file to use
   if (FileExists("C:\_APPS\ERPP\nopic.bmp")) then
    this.dw_1.object.p_emp.filename = "C:\_APPS\ERPP\nopic.bmp"
    this.dw_1.object.p_emp.filename = "nopic.bmp"
   end if

   return lb_rc

  end if

  // Remove old picture file
  if (FileExists("C:\_APPS\ERPP\emp_pic.bmp")) then
  end if

  // Opens picture file
  li_fileNum = FileOpen("C:\_APPS\ERPP\emp_pic.bmp", StreamMode!,
  & Write!, LockReadWrite!)

  // Determine how many times to call FileWrite
  IF (ll_file_len > 32765) THEN

   // Determines how many loops we need
   IF (Mod(ll_file_len, 32765) = 0) THEN
    li_loops = ll_file_len / 32765
    li_loops = (ll_file_len / 32765) + 1

   li_loops = 1

  // Initializes
  ll_tot_bytes = 1

  // Writes blob to file
  FOR i = 1 to li_loops
   b_temp = BlobMid(b_pic, ll_tot_bytes, 32765)
   ll_bytes = FileWrite(li_fileNum, b_temp)
   ll_tot_bytes += ll_bytes

  // Closes file

  // Sets picture file to DW
  this.dw_1.object.p_emp.filename = "C:\_APPS\ERPP\emp_pic.bmp"

The above code saves the database blob column to a temporary file on disk,
then assign it to a empty bitmap control on the dw


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Its working now, thanks.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.