奇怪,我把jpg图片用 insert 存入数据库中,取出时,怎么也不能将其还原到图片控件上。

fishead37 2004-08-11 05:01:33
写入:
//上传照片
string ls_path, ls_name
blob lb_pic
integer value, li_loops
Long ll_hand, ll_file_l
String ls_emp_id
ls_emp_id = Trim(dw_1.GetItemString(dw_1.GetRow(),'emp_id'))
value = GetFileOpenName("请选择员工的照片:", ls_path, ls_name,"BMP", "BMP文件(*.BMP)," + &
"*.BMP, GIF文件(*.GIF),*.GIF, Jpg文件(*.jpg),*.jpg")

ll_file_l=filelength(ls_path)
IF ll_file_l > 32765 THEN
IF Mod(ll_file_l, 32765) = 0 THEN
li_loops = ll_file_l/32765
ELSE
li_loops = (ll_file_l/32765) + 1
END IF
ELSE
li_loops = 1
END IF
IF value = 1 THEN
ll_hand = FileOpen(ls_name,StreamMode!)
FileRead(ll_hand, lb_pic)
FileClose(ll_hand)
End If

Insert Into empployee_pic
values (:ls_emp_id, :lb_pic);
commit;
p_1.setpicture(lb_pic)
p_1.Width = 418
p_1.Height = 512
p_1.visible=true
但是我读取表中的数据进行, 还原到p_1中时, 没有任何显示??“??
//当读取当前员工资料后,就将照片传给p_1
Blob lb_pic
String ls_emp_id
If rowcount = 0 Then Return
ls_emp_id = This.Object.emp_id[This.GetRow()]
messagebox('',ls_emp_id)

sqlca.autocommit=true
SelectBlob emp_pic Into :lb_pic
From empployee_pic Where emp_id = :ls_emp_id;
if sqlca.sqlnrows>1 then
sqlca.autocommit=false
messagebox("提示","读取物料图片时出错")
return
end if
sqlca.autocommit=false
if sqlca.sqlcode=100 or isnull(lb_pic) then return
messagebox('',1)
p_1.SetPicture(lb_pic)
p_1.Height = 512
p_1.Width = 480
p_1.Visible = True
...全文
117 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
鸡翅多 2004-08-11
  • 打赏
  • 举报
回复
blob数据不能用insert,只能用updateblob

1,077

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧