标题:求助......为什么不能保存图片呢
只看楼主
wang828
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2006-3-20
 问题点数:0 回复次数:1 
求助......为什么不能保存图片呢

sqlca.autocommit=true
updateblob "t_goods" set "t_goods"."pic"=:ls_pic where "t_goods"."goodscode"=:ls_goodscode using sqlca;
if SQLCA.SQLNROWS >0 then
commit using sqlca;
end if
SQLCA.AutoCommit = False

服务器是MS SERVER 2000 ,ls_pic 是图片的全局变量,已可以在图片框显示了,但是就不能保存,,,是为什么呢,,,有没有那们大侠帮一下我呢.最好有一成功提交过有代码给提供一下,
多谢帮忙!!!!!!!!!!!

搜索更多相关主题的帖子: 服务器 goods sqlca pic using 
2006-03-20 11:35
qw_bright
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2006-3-18
得分:0 
图片保存


String ls_file
ls_file=Trim(sle_file.text)
if IsNull(ls_file) or ls_file='' then
Messagebox("数据提示","请选择文件")
return
end if
if not FileExists(ls_file) then
Messagebox("数据提示","文件不存在")
return
end if
integer iOpen,iRead,iLoop,i
blob bReadData,bAllReadData
long ll_fileSize,bAllRead
ll_fileSize=filelength(ls_file)
iOpen=FileOpen(ls_file,StreamMode!,Read!,LockRead!)


iLoop=ll_fileSize/32765 + 1
for i=1 to iLoop
iRead=FileRead (iOpen,bReadData)
if i=1 then
bAllReadData=bReadData
else
bAllReadData=bAllReadData+bReadData
end if
next
FileClose(iOpen)
long ll_maxid,count
String ls_maxid,ls_newId
String ls_note
String ls_filename
ls_note=sle_note.text
ls_filename=sle_name.text

select count(*)
into :count
from z_photo
where photoname=:ls_filename;
if count>0 then
Messagebox("数据提示","库中已有同名文件")
return
end if
select max(id)
into :ls_maxid
from z_photo;
if IsNull(ls_maxid) then ls_maxid='0'
ll_maxid=long(ls_maxid)
ls_newId=String(ll_maxid+1,'0000')
INSERT INTO z_photo( id,photo,note,photoname)
VALUES ( :ls_newId,
null,
:ls_note,
:ls_filename) ;

if sqlca.sqlcode<>0 then goto Error
commit;
Updateblob z_photo Set photo =:bAllReadData Where id=:ls_newId;
if SQLCA.SQLNRows>0 Then
COMMIT;
Messagebox("信息", "保存图片信息成功!")
else
goto Error
end if
return
Error:
rollback;
Messagebox("信息", "保存图片信息失败!")

2006-03-20 16:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-51541-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.083630 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved