今天最后的问题,在线等!!

notlonely 2003-08-22 11:46:33
SQLCA.AutoCommit = true
int fi
blob this_picture
fi=fileopen("G:\se.bmp",streammode!,read!,lockread!)
fileread(fi,this_picture)
fileclose(fi)

p_1.setpicture(this_picture)//可以显示出来

updateblob pic=:this_picture from test where id=1 using sqlca ;


IF sqlca.SQLNRows > 0 THEN
COMMIT ;
messagebox('a','ok')
Else
messagebox('b','cancel')
end if

无法存到数据库

为什么呀
????!!!
...全文
50 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
athere_08 2003-08-23
  • 打赏
  • 举报
回复
updateblob product set description_image=:lb_picture where product.no=:ls_no;
我一般也用这样的sql语句,用sqlca.sqlcode检查执行结果
klbt 2003-08-23
  • 打赏
  • 举报
回复
同意楼上,无论读写,如果你的bmp文件大于32k,都要分多次,不过好像问题不在这里。
你的test表中必须事先有id=1的行。
pbtech 2003-08-22
  • 打赏
  • 举报
回复
如果行的话,给我分呀!!!
pbtech 2003-08-22
  • 打赏
  • 举报
回复
我要升级!!

如果你的bmp文件大于32k要多次读取

sqlca.autocommit=true;
string ls_photofile,ls_named,ls_no

integer li_value,li_filenum,li_loops,li_counter,li_t
long ll_filelen
blob lb_read,lb_picture

ls_no=dw_1.getitemstring(dw_1.getrow(),"no")
li_value=getfileopenname("",ls_photofile,ls_named,"图片文件","bmp files (*.bmp),*bmp,"+"jpg file (*.jpg),*.jpg")
if li_value=-1 or li_value =0 then return
ll_filelen=filelength(ls_photofile)
li_filenum=fileopen(ls_photofile,streammode!,read!,lockread!)
if ll_filelen>32765 then
li_loops=((ll_filelen - 1)/32765)+1
else
li_loops=1
end if
//read file
for li_counter=1 to li_loops
fileread(li_filenum,lb_read)
lb_picture=lb_picture+lb_read
next
fileclose(li_filenum)
//show pic
li_t=p_1.setpicture(lb_picture)
if li_t=1 then
p_1.visible=true
end if
//write database
updateblob product set description_image=:lb_picture where product.no=:ls_no;
//SELECTBLOB description_image INTO :lb_picture FROM product WHERE
//prodct.no=:ls_no USING sqlca;
//p_1.setpicture(lb_picture)
IF SQLCA.SQLCode = -1 THEN
MessageBox("SQL error", SQLCA.SQLErrText)
END IF
sqlca.autocommit=false;

740

社区成员

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

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