<%
FPFileName=server.MapPath("data/领用表.xls")
Dim Connxls,Driver,DBPath,Rs
' 建立Connection对象
Set Connxls = Server.CreateObject("ADODB.Connection")
Driver = "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;"
'应该首先判断文件是否存在,如果不存在给出提示信息
xlsPath = "DBQ=" & FPFileName
'response.Write xlsPath
'调用Open 方法打开数据库
Connxls.Open Driver & xlsPath
dim rs_xls 'excel结果集
dim rs_sql '数据库结果集
dim i
set rs_xls=server.createobject("adodb.recordset")
rs_xls.open "select * from [sheet1$]",connxls,1,1
if rs_xls.eof then
response.write "表中没有数据!"
else
i=0
errflag=0
%>
<%
do while not rs_xls.eof
response.write "i="&i+1&" "&rs_xls("产品编号")&" "&rs_xls("产品名称")&" "&rs_xls("型号")&" "&rs_xls("供货商")&" "&rs_xls("凭证号")&" "&rs_xls("数量")&" "&rs_xls("单价")&" "&rs_xls("金额")&" "&rs_xls("部门编号")&" "&rs_xls("部门名称")&" "&rs_xls("领用人")&" "&rs_xls("领用日期")&" "&rs_xls("年份")&" "&rs_xls("季度")&"<br>"
response.Write("<hr>")
response.flush
if rs_xls("产品编号")="" then
temp11="i="&i+1&" "&rs_xls("产品名称")&" "&rs_xls("凭证号")&" "&rs_xls("部门名称")&" "&rs_xls("领用日期")&" 唯一标识为空"
%>
<p><font color="#FF0000"> <%=temp11%></font></p>
<%
errflag=1
exit do
end if
if err.number <> 0 then
errflag=1
response.write "MOVENEXT errcode="&err.number&" "&err.description&"<br>"
response.write "表中数据有误,请核对<br>"
response.write "i="&i+1&" "&rs_xls("产品名称")&" "&rs_xls("型号")&" "&rs_xls("供货商")&" "&rs_xls("凭证号")&" "&rs_xls("数量")&" "&rs_xls("单价")&" "&rs_xls("金额")&" "&rs_xls("领用部门")&" "&rs_xls("领用人")&" "&rs_xls("领用日期")&"<br>"
response.flush
exit do
end if
rs_xls.movenext
i=i+1
loop
if errflag=1 then
%>
<p><font color=#FF0000>信息有误</font></p>
<%
else
%>
<p><font color="#00FF00" size="13"> 已全部装入数据库,共装入<%=cstr(i)%>条数据!!</font></p>
<p><a href="javascript:history.back(-1);">返回</a></p>
<%
end if
end if
rs_xls.close
set rs_xls=nothing
%>
代码如上, excel文件的数值如下:
用上面的代码读取后,如下:
请问这是什么原因造成的啊?