能解决给50分,(asp问题)

来源:百度知道 编辑:UC知道 时间:2024/05/22 23:59:30
代码如下:
<%
dim arrayid,jh,goodsid,jhsl,rs,i
arrayid = Request.Form("arrayid")
jh = Request.Form("jh")
arrayId = split(arrayid,",")
jh = split(jh,",")
Set rs = Server.CreateObject("ADODB.Recordset")
for i=0 to ubound(arrayid)
if jh(i) <> " " then
goodsid = cint(arrayid(i))
jhsl=formatnumber(jh(i),0)
rs.open "select top 1 * from yhjh",conn,3,2
rs.addnew
rs("goodsid") = goodsid
rs("jhsl") = jhsl
rs.Update
rs.Close
end if
next
Set rs = Nothing
response.write "<script>alert('本页的采购计划数量提交成功!');</script>"
%>
jh 为要许多要添加的数量数组,有null存在,只要不是jh(0)为null就能正常执行

只要jh(0) 为null 值时就会报错:
错误类型:
Provider (0x80020005)
类型不匹配。
/test/pzplantj.asp, 第 28 行 (rs("jhsl") = jhsl 这行)
jh(0) 不为null 时,就一切正常.

这样可不:是NOLL时就不添加,使用IF语句.
使用这句试下:

我想我知道了.
有这样一种情况:它只是一个或两个空格,所以还要排除这种情况.
if len(jh(i))<>0 then
if not jh(i)= " " or not jh(i)= " "then
....
end if

引号里分别打一个和两个空格.