P_1.setpicture()显示图片问题
我用的是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就不可以?
有达人能帮我看看吗?