//***************************************************************
函数gf_open_pic:
//////////////////////////////////////////////////////////////////
//Add by Jeffrey Jiang on 2001.11.13
//选择图片
/////////////////////////////////////////////////////////////////
//Modfiy by Jeffrey Jiang on 2001.11.15
//当图片字节大于32765时,循环读图片
/////////////////////////////////////////////////////////////////
integer li_file,li_ret,loops,i
string ls_file,ls_path
blob lb_small
long flen,bytes_read,new_pos
//search the file
li_ret = getfileopenname("选择图片文件",ls_path,ls_file, &
"BMP","图片文件(*.BMP),*.BMP")
if li_ret = 1 then
p_1.picturename = ''
p_1.picturename = ''
setnull(lb_image)
if li_file <> -1 then
// Set a wait cursor
setpointer(hourglass!)
flen = filelength(ls_file)
li_file = fileopen(ls_path,streammode!,read!,lockread!)
// Determine how many times to call FileRead
if flen > 32765 then
if mod(flen,32765)=0 then
loops = flen/32765
else
loops = (flen/32765) + 1
end if
else
loops = 1
end if
// Read the file
new_pos = 1
for i = 1 to loops
bytes_read = fileread(li_file,lb_small)
if i = 1 then
lb_image = lb_small
else
lb_image = lb_image + lb_small
end if
next
// close the file
fileclose(li_file)
end if
end if
return lb_image
//***************************************************************
保存按钮代码:
UPDATEBLOB "person" SET "person"."PHOTO" = :lb_image WHERE "person"."C_ID" = :ls_c_id USING SQLCA;
IF sqlcadoor.SQLNRows > 0 THEN
commit using sqlca;
END IF