Resolved Ole Database Blob
- How-to
- James Medick
- PowerBuilder
- Sunday, 21 June 2020 04:33 PM UTC
I have an Oledatabase Blob object on a datawindow that works fine. I can store and retrieve to the database. I would like to add a function to select an existing document and store it as a blob in the table. I'm using the GetOpenFileName function (lastest version of PB), which selects the file and stores it in a Blob variable. I then take the variable and update the table through embeded SQL. This works, but when using the OleDatabase Blob object (clicked event), it retrieves a blank document.
Updating any blob in the table directly causes the PB object not to work. I suspect either that PB has some additional controls its using or I am updating the blob column in error. The code looks like:
if GetFileOpenName ("Select File", ls_fullname, ls_filename) < 1 Then
return
End If
li_fileid = FileOpen (ls_fullname, StreamMode!)
FileReadEX (li_fileid, lb_policy)
FileClose (li_fileid)
ls_id = dw_detail.GetItemString(1, "idpolicies")
Update policy_blob Set policy_blob = :lb_policy
Where idpolicies = :ls_id
Using SQLCA;
If SQLCA.SQLCODE = 0 Then
Commit Using SQLCA;
Else
RollBack Using SQLCA;
MessageBox("System Failure", "Failure to update the blob object")
End If
This code runs without error but the PB data window object will not display it. it will only display what it wrote itself.
James
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.