程序如下:
for i=1 to 28
set rs = server.CreateObject ("adodb.recordset")
sqlstr="select * from piaoy"
rs.Open sqlstr,conn,1,3
rs.addnew
rs("bh")=trim(request.form("包号")(i))
rs("tm")=trim(request.form("条码")(i))
rs("yph")=trim(request.form("样批号")(i))
rs("zmdj")=trim(request.form("籽棉等级")(i))
rs("mzh")=trim(request.form("毛重")(i))
rs("jzh")=trim(request.form("净重")(i))
rs("hchl")=trim(request.form("回潮率")(i))
rs("pzh")=trim(request.form("皮重")(i))
rs("jglx")=trim(request.form("加工类型")(i))
rs("chpmch")=trim(request.form("产品名称")(i))
rs("shchrq")=trim(request.form("产品名称")(i))
rs("jgnd")=trim(request.form("加工年度")(i))
rs("jyjgmch")=trim(request.form("检验机构名称")(i))
rs("pj")=trim(request.form("品级")(i))
rs("chdj")=trim(request.form("长度级")(i))
rs("mklzhj")=trim(request.form("马克隆值级")(i))
rs("mklzh")=trim(request.form("马克隆值")(i))
rs("hzl")=trim(request.form("含杂率")(i))
rs("ygzhl")=trim(request.form("轧工质量")(i))
rs("szdj")=trim(request.form("色泽等级")(i))
rs("chdzhqd")=trim(request.form("长度整齐度")(i))
rs("dxwzhsh")=trim(request.form("短纤维指数")(i))
rs("fshl")=trim(request.form("反射率")(i))
rs("hd")=trim(request.form("黄度")(i))
rs("dlshchl")=trim(request.form("断裂伸长率")(i))
rs("bqd")=trim(request.form("比强度")(i))
rs("chshdxsh")=trim(request.form("成熟度系数")(i))
rs("chd")=trim(request.form("产地")(i))
rs("bzh")=trim(request.form("备注")(i))
rs.Update
rs.Close
set rs=nothing
next
response.write "<font color=#000000>excel表中的 "& recCnt & " 组数据已成功写入数据库!<a href='xs.asp' target='_blank'>显示数据库</a></font>"
运行的时候出现错误:
请求对象 错误 'ASP 0105 : 80004005'
索引越界
但是我如果把出错的一行: rs("szdj")=trim(request.form("色泽等级")(i))
后面的: rs("szdj")=trim(request.form("色泽等级")(i))
rs("chdzhqd")=trim(request.form("长度整齐度")(i))
rs("dxwzhsh")=trim(request.form("短纤维指数")(i))
rs("fshl")=trim(request.form("反射率")(i))
rs("hd")=trim(request.form("黄度")(i))
rs("dlshchl")=trim(request.form("断裂伸长率")(i))
rs("bqd")=trim(request.form("比强度")(i))
rs("chshdxsh")=trim(request.form("成熟度系数")(i))
rs("chd")=trim(request.form("产地")(i))
rs("bzh")=trim(request.form("备注")(i))
这些去掉的话就能正常执行,不知道为什么?郁闷死了!难道还有插入字段数的限制不成??!!
请高手执教,谢谢!!!