I need to perform a data conversion from the old db ms sql 6.5 , now i have issue with the image store inside ms sql 6.5, this image stored are all ole data meaning the old application that interface this ms sql 6.5 actually store the image as ole in the image type. when i selectblob into a blob in powerbuilder i need to send this blob into ole_1.objectdata, then translate this ole_1.objectdata into the desired length in order to be output into a bitmap file on disk, i have extracted this translation code from expert-exchanged at "Printing Blob to bmp/jpg" (posted by Buasuwan, however cannot manage to get the dll as the post is an old post). It work fine for 60% of my blob converted to bitmap while the remaining produce empty view with relevant file size, just cannot view it only .here is the code, i wish some gurus there can help me with the ole translation to bitmap
Blob lb_image
SelectBLOB picture_image into :lb_image
from individual
where individual_object_id='200506061121430020'
using SQLCA;
if SQLCA.sqlcode<>0 then
messagebox("cannot connect","cannot connect")
end if
if(len(lb_image)>0) then
ole_1.objectdata=lb_image
gf_convertbmp(ole_1.objectdata,ls_path)
end if
my gf_convertbmp as follows
long ll_index, ll_len, ll_length
integer li_FileNum
// Find Keyword 'BM' for starting Bitmap File
ll_len = Len(lb_ole_data)
ll_index = 1
blob lb_bm
lb_bm = blob('BM')
do while ll_index <= ll_len
if BlobMid(lb_ole_data, ll_index, 2) = lb_bm then
exit
end if
ll_index++;
loop
// Find Length of Image
ll_length = long(asc(char(BlobMid(lb_ole_data, ll_index - 4, 1)))) + &
long(asc(char(BlobMid(lb_ole_data, ll_index - 3, 1)))) * 256 + &
long(asc(char(BlobMid(lb_ole_data, ll_index - 2, 1)))) * 65536
// Save Bitmap to File
li_FileNum = FileOpen(filename, StreamMode!, Write!, LockWrite!, Replace!)
// Write Bitmap Data
do while ll_length > 0
if ll_length > 32000 then
FileWrite(li_FileNum, BlobMid(lb_ole_data, ll_index, 32000))
else
FileWrite(li_FileNum, BlobMid(lb_ole_data, ll_index, ll_length))
exit
end if
ll_index += 32000
ll_length -= 32000
loop
FileClose(li_FileNum)