有一个字符串,在转换成二进制作,保存到字段类型为blob的字段内,以下代码出错:
a=objrs("strtracker")
b=objrs("id")
c=str2bin(a)
sql1="select info_hash,upid from xbt_files where upid=8"
rs.open sql1,conn,1,3
if not rs.eof then
rs("info_hash").appendchunk(c)
rs.update
end if
rs.close出错提示:
Provider 错误 '80040e21' 多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。 Function Str2Bin(String)
Dim i, tmpbin
For i=1 to strLength(String)
tmpbin = tmpbin & ChrB(Asc(Mid(String,I,1)))
Next
Str2Bin = tmpbin
End FunctionFunction strLength(str)
If (len("飞鸟")=2) then
Dim l,t,c,i
l=Len(str)
t=l
For i=1 To l
c=asc(mid(str,i,1))
If c<0 Then
c=c+65536
End If
' asc对中文字符求出来的值可能为负数,
' 加上65536就可求出它的无符号数值
' -1在机器内是用补码表示的0xffff,
' 其无符号值为65535,65535=-1+65536
' 其他负数依次类推。
If c>255 Then
t=t+1
End If
Next
strLength=t
Else
strLength=len(str)
End If
End Function
a=objrs("strtracker")
b=objrs("id")
c=str2bin(a)
sql1="select info_hash,upid from xbt_files where upid=8"
rs.open sql1,conn,1,3
if not rs.eof then
rs("info_hash").appendchunk(c)
rs.update
end if
rs.close出错提示:
Provider 错误 '80040e21' 多步 OLE DB 操作产生错误。如果可能,请检查每个 OLE DB 状态值。没有工作被完成。 Function Str2Bin(String)
Dim i, tmpbin
For i=1 to strLength(String)
tmpbin = tmpbin & ChrB(Asc(Mid(String,I,1)))
Next
Str2Bin = tmpbin
End FunctionFunction strLength(str)
If (len("飞鸟")=2) then
Dim l,t,c,i
l=Len(str)
t=l
For i=1 To l
c=asc(mid(str,i,1))
If c<0 Then
c=c+65536
End If
' asc对中文字符求出来的值可能为负数,
' 加上65536就可求出它的无符号数值
' -1在机器内是用补码表示的0xffff,
' 其无符号值为65535,65535=-1+65536
' 其他负数依次类推。
If c>255 Then
t=t+1
End If
Next
strLength=t
Else
strLength=len(str)
End If
End Function
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货