导入成功了 ,但数据库的记录笔EXCEL表格的数据少了 几十条
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!-- #include file="conn.asp" -->
<%
'连接excel数据库
Dim xlsconn,xlsstr,xlsrs,sql,i
Set xlsconn = server.CreateObject("adodb.connection")
xlsstr="Provider=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="&server.mappath("productlist.xls")&";Extended Properties=Excel 8.0"
xlsconn.open xlsstr
Set xlsrs = Server.CreateObject("Adodb.RecordSet")
'sql = "Select * from [productlist$]"
sql = "SELECT * FROM [" & "Sheet1" & "$]"
xlsrs.open sql,xlsconn,1,3
If xlsrs.eof Then
response.Write "----------------"
else
i=1
response.write" <div align='center'>"
response.write " <TABLE border=1>"
Do While not xlsrs.eof
lei1=xlsrs("产品所属大类")
lei2=xlsrs("产品种类")
lei3=xlsrs("产品子类")
name1=xlsrs("产品名称")
photo="images/upfile/"&xlsrs("产品图片名称")
brand=xlsrs("品牌/产商")
xinghao=xlsrs("产品型号")
detail=xlsrs("产品描述")
content=xlsrs("产品规格/参数")
if lei3 <>"" then
leiname=lei3
elseif lei2 <>"" then
leiname=lei2
else
leiname=lei1
end if
set rsacc=server.CreateObject("adodb.recordset")
rsacc.open "select categoryid from category where category='"&leiname&"' ",conn,1,3
sqla="select categoryid from category where category='"&leiname&"' "
'response.Write sqla
if not rsacc.eof then
categoryid=rsacc("categoryid")
end if
rsacc.close
%>
<TR>
<TD> <%=lei1%> </TD>
<TD> <%=lei2%> </TD>
<TD> <%=lei3%> </TD>
<TD> <%=name1%> </TD>
<TD> <%=photo%> </TD>
<TD> <%=brand%> </TD>
<TD> <%=xinghao%> </TD>
<TD> <%=detail%> </TD>
<TD> <%=content%> </TD>
<TD> <%=xlsrs("企业名称")%> </TD>
<TD> <%=xlsrs("电话")%> </TD>
<TD> <%=xlsrs("传真")%> </TD>
<TD> <%=xlsrs("邮箱")%> </TD>
<TD> <%=xlsrs("邮编")%> </TD>
<TD> <%=xlsrs("地址")%> </TD>
<TD> <%=xlsrs("网址")%> </TD>
</TR>
<%
set rscp=server.CreateObject("adodb.recordset")
sqlcp="select * from product where name='"&name1&"'"
response.Write sqlcp
rscp.open sqlcp,conn,1,3
if not rscp.eof then
response.Write "记录已经存在!"&i
else
'grade:产品型号 ,type:企业名称 ,introduce:地址 ,addlink:认证标准 ,detail:产品描述 ,content:产品规格/参数
sql="insert into product(categoryid,name,mark,grade,type,tel,fax,email,postcode,introduce,weburl,photo,detail,content) values('"&categoryid&"','"&name1&"','"&brand&"','"&xinghao&"','"&xlsrs("企业名称")&"','"&xlsrs("电话")&"','"&xlsrs("传真")&"','"&xlsrs("邮箱")&"','"&xlsrs("邮编")&"','"&xlsrs("地址")&"','"&xlsrs("网址")&"','"&photo&"','"&detail&"','"&content&"')"
response.Write "记录不存在!"
end if
'response.Write sql
conn.execute(sql)
i=i+1
name1=""
leiname=""
xlsrs.movenext
Loop
response.write " </table>"
End If
rscp.close
set rscp=nothing
xlsrs.close
xlsconn.close
Response.write "共导入 <font color='red'>" & i-1 & " </font>条记录. <br>" & vbCrLf
response.write" </div>"
set xlsrs=nothing
set xlsconn=nothing
%>
导入成功了 ,但数据库的记录笔EXCEL表格的数据少了 几十条 EXCEL表格 有1点多M 什么问题呢