P_1.setpicture()显示图片问题

hrh810420 2010-07-15 11:16:32
我用的是pb 9.0+sql2000.
代码如下:


//filedisk
//fileread
string filepath,filename
string ll_path
int i,f_num,loops,j
long f_long,sum_read,p_new
blob tot_b,b,pic
p_new=0
i=getfileopenname('请选择图片',filepath,filename,"all Files (*.jpg),*.bmp,*.jpg");
sle_path.text=filepath

f_long=filelength(trim(sle_path.text))

f_num=fileopen(trim(sle_path.text),STREAMMODE!,READ!,LOCKREAD!)


//以每次读取32K为基础,决定读取几次
if f_long>32765 then
if mod(f_long,32765)=0 then
loops=f_long/32765
else
loops=f_long/32765+1
end if
else
loops=1
end if
//循环读取
for i=1 to loops
sum_read=fileread(f_num,b)
tot_b=tot_b+b
p_new=p_new+sum_read
fileseek(f_num,p_new, FROMBEGINNING!)
next
fileclose(f_num)

p_1.visible=true
SetPicture(p_1,tot_b)


sqlca.autocommit=true

select count(*) into :j from s_orgcode_pic
where orgcode=:ll_depot;

if j=0 or isnull(j) then

insert into s_orgcode_pic(orgcode,pic ,createtime )
values (:ll_depot,:tot_b,getdate());
end if
if sqlca.sqlcode<>0 then
messagebox("提示","生成数据失败"+SQLCA.SQLErrText)
return 1
end if


updateblob s_orgcode_pic set pic=:tot_b
where orgcode=::ll_depot;

sqlca.autocommit=false
selectblob pic into :pic
from s_orgcode_pic where orgcode=:ll_depot;


//p_1.SetPicture(pic)


数据库表create table s_orgcode_pic
(orgcode varchar(12),
pic image null ,
createtime datetime)


执行完,在数据库中有数据,就是用selectblob后无法显示图片.
我把SetPicture(p_1,tot_b) 放在数据库存储前执行是能够显示的.放到selectblob就不可以?
有达人能帮我看看吗?










...全文
473 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chengg0769 2010-07-15
  • 打赏
  • 举报
回复
blob写入要先写入那一行数据,建表时允许blob字段(image类型)为空,然后在updateblob(autocommit=true).直接insert不行。

754

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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