⊙-⊙mssql2000,存储过程有一个二进制参数。错了啊~!

ChinaOk 2004-02-24 05:40:56
存储过程就是下面这个,很简单的一个功能啊。

create procedure [dbo].[insertblob]
@blobbody image
as
--declare @li_len int
--set @li_len = datalength(@blobbody)
insert into tbltest(blobbody)values(@blobbody)
--return @li_len
go

然后pb里通过这样声明来调用的:
function long usp_insertblob(blob blobbody) rpcfunc alias for "dbo.insertblob"

调用时,错误 提示是“操作数类型冲突:text与image不兼容”

我传入的是一个图片的二进制变量啊。??



请教高手!!!
...全文
51 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ChinaOk 2004-07-02
  • 打赏
  • 举报
回复
不是这个意思,读取当然要分块了。写入呢?能不能不用updateblob
直接用存储过程
pb8oracle 2004-05-11
  • 打赏
  • 举报
回复
二进制需要分块存储!
按照
integer li_file,li_ret,loops,i
string ls_file,ls_path
blob lb_small
long flen,bytes_read,new_pos

//search the file
li_ret = getfileopenname("选择图片文件",ls_path,ls_file, &
"BMP","图片文件(*.BMP),*.BMP")
if li_ret = 1 then
p_1.picturename = ''
p_1.picturename = ''
setnull(lb_image)
if li_file <> -1 then
// Set a wait cursor
setpointer(hourglass!)

flen = filelength(ls_file)
li_file = fileopen(ls_path,streammode!,read!,lockread!)
// Determine how many times to call FileRead
if flen > 32765 then
if mod(flen,32765)=0 then
loops = flen/32765
else
loops = (flen/32765) + 1
end if
else
loops = 1
end if
// Read the file
new_pos = 1
for i = 1 to loops
bytes_read = fileread(li_file,lb_small)
if i = 1 then
lb_image = lb_small
else
lb_image = lb_image + lb_small
end if
next
// close the file
fileclose(li_file)
end if
end if
return lb_image
然后存入数据库
UPDATEBLOB "person" SET "person"."PHOTO" = :lb_image WHERE "person"."C_ID" = :ls_c_id USING SQLCA;
IF sqlca.SQLNRows > 0 THEN
commit using sqlca;
END IF
就是这个意思,按照这种方式存入数据库表中!

752

社区成员

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

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