0

I am storing some (blob) images on a SQL 2012 express using filestream. I want to know how to show and retrieve those images on my client app from the database using PowerBuilder 12.5

Any idea?

Thanks in advance.

Terry
  • 6,160
  • 17
  • 16
wen
  • 13
  • 6

1 Answers1

1

From the PB help file:

Blob Emp_id_pic

SELECTBLOB Emp_pic        
INTO :Emp_id_pic         
FROM Employee        
WHERE Employee.Emp_Num = 100        
USING Emp_tran ;

p_1.SetPicture(Emp_id_pic)
Seki
  • 11,135
  • 7
  • 46
  • 70
Matt Balent
  • 2,337
  • 2
  • 20
  • 23
  • I cant retrieve the image like that, not using filestream (already tried) any other suggestion? Thanks anyways! – wen Nov 10 '14 at 15:52
  • Maybe i am doing wrong the insert with filestream? This is my insert statment 'INSERT INTO dbo.IMG_PRUEBA VALUES(newid(), 'img1', CAST ( 'C:\Users\x\Desktop\Chrysanthemum.jpg' AS VARBINARY(MAX)))' – wen Nov 10 '14 at 15:55
  • 1
    Matt is on the right track. There is no concept of a filestream in PB. To deal with blobs on the database, you need to use SELECTBLOB, INSERTBLOB and UPDATEBLOB. – Terry Nov 10 '14 at 16:46
  • Your initial post indicated you were retrieving images from a database, hence the SELECTBLOB answer. If you are looking to read an image file into PowerBuilder and then save it to the DB you should take a look at FILEOPEN and FILEREADEX in the help (make sure you open the file using StreamMode!). – Matt Balent Nov 11 '14 at 11:57