string p
long k,kkkk=1, i , l_id
blob a4
int j
blob l_blob
for j=1 to ds_1.rowcount( )
l_id = ds_1.getitemnumber( j, "id")
selectblob picture into :l_blob from tbImage where id=:l_id using sqlca;
i = FileOpen(temp_path+"\temp_photo"+trim(string(l_id))+".jpg",StreamMode!,Write!,LockWrite!,Replace!)
k = len(l_blob)
kkkk=1
if k>0 then
do while kkkk < k
a4 = blobmid(l_blob, kkkk, 32765)
if filewrite(i,a4)=-1 then EXIT
kkkk= 32765 + kkkk
loop
kkkk=0
fileclose(i)
end if
string m
dw_2.insertrow( 0 )
dw_2.setitem( dw_2.rowcount() , "sys_time" ,temp_path+"\temp_photo"+trim(string(l_id))+".jpg")
next