文件名称:PowerBuilder读取保存图片
介绍说明--下载内容来自于网络,使用问题请自行百度
//读取保存图片
string ls_pathname, ls_filename
integer li_value,li_FileNum,loops,i
long ll_fileLength,bytes_read,new_pos
blob b, tot_b
Blob gb_photo
INSERT INTO PJ_TP(AA) VALUES ('1') USING SQLCA;
COMMIT USING SQLCA;
li_value = GetFileOpenName("选择照片", &
+ ls_pathname, ls_filename, "jpg","Jpg Files (*.jpg),*.jpg")
IF li_value = 1 THEN
// Set a wait cursor
SetPointer(HourGlass!)
// Get the file length, and open the file
ll_fileLength= FileLength(ls_filename)
li_FileNum = FileOpen(ls_filename, &
StreamMode!, Read!, LockRead!)
// Determine how many times to call FileRead
IF ll_filelength > 32765 THEN
IF Mod(ll_filelength, 32765) = 0 THEN
loops =ll_filelength/32765
ELSE
loops = (ll_filelength/32765) + 1
END IF
ELSE
loops = 1
END IF
// Read the file
new_pos = 1
FOR i = 1 to loops
bytes_read = FileRead(li_FileNum, b)
tot_b = tot_b + b
//
IF i=1 then
st_1.text=string(tot_b)
end if
//
NEXT
FileClose(li_FileNum)
gb_photo=tot_b
UPDATEBLOB PJ_TP SET photo=:gb_photo WHERE AA='1' USing sqlca;
IF Sqlca.SQLNRows > 0 THEN
COMMIT USING SQLCA;
END IF
P_1.setpicture(gb_photo)
st_1.text=string(len(gb_photo))
Elseif li_value=-1 then
MessageBox("选择照片","打开文件错误!")
End If
string ls_pathname, ls_filename
integer li_value,li_FileNum,loops,i
long ll_fileLength,bytes_read,new_pos
blob b, tot_b
Blob gb_photo
INSERT INTO PJ_TP(AA) VALUES ('1') USING SQLCA;
COMMIT USING SQLCA;
li_value = GetFileOpenName("选择照片", &
+ ls_pathname, ls_filename, "jpg","Jpg Files (*.jpg),*.jpg")
IF li_value = 1 THEN
// Set a wait cursor
SetPointer(HourGlass!)
// Get the file length, and open the file
ll_fileLength= FileLength(ls_filename)
li_FileNum = FileOpen(ls_filename, &
StreamMode!, Read!, LockRead!)
// Determine how many times to call FileRead
IF ll_filelength > 32765 THEN
IF Mod(ll_filelength, 32765) = 0 THEN
loops =ll_filelength/32765
ELSE
loops = (ll_filelength/32765) + 1
END IF
ELSE
loops = 1
END IF
// Read the file
new_pos = 1
FOR i = 1 to loops
bytes_read = FileRead(li_FileNum, b)
tot_b = tot_b + b
//
IF i=1 then
st_1.text=string(tot_b)
end if
//
NEXT
FileClose(li_FileNum)
gb_photo=tot_b
UPDATEBLOB PJ_TP SET photo=:gb_photo WHERE AA='1' USing sqlca;
IF Sqlca.SQLNRows > 0 THEN
COMMIT USING SQLCA;
END IF
P_1.setpicture(gb_photo)
st_1.text=string(len(gb_photo))
Elseif li_value=-1 then
MessageBox("选择照片","打开文件错误!")
End If
相关搜索: PowerBuilder,读取,保存,图片
(系统自动生成,下载前可以参看下载内容)
下载文件列表
压缩包 : PowerBuilder读取保存图片.doc 列表
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.