<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<title>临朐县农村信用社计算机培训档案管理系统--批量导入员工基本信息Excel记录</title>
<meta http-equiv="Content-Type"
  content="text/html; charset=gb2312">
<link rel="stylesheet" href="">
<!--
body,td,th {
    font-size: 16px;
}
.STYLE1 {
    color: #FF6600;
    font-weight: bold;
}
.mycolor:link {
    text-decoration: none;
}
.mycolor:visited {
    text-decoration: none;
    color: #E85C00;
}
.mycolor:hover {
    text-decoration: underline;
    color: #339900;
}
.mycolor:active {
    text-decoration: none;
    color: #339900;
}
.STYLE19 {color: #E85C00; font-size: 12px; }
.STYLE20 {
    font-size: 14px;
    color: #FF0000;
}
.STYLE23 {font-size: 13px}
a:link {
    color: #FF6600;
}
a:visited {
    color: #FF6600;
}
a:hover {
    color: #009900;
}
a:active {
    color: #009900;
}
.STYLE24 {
    color: #000000;
    font-size: 15px;
}
-->
</style></head>
<body bgcolor="#CCFFCC">
  
          
<p align="center" class="STYLE19"> <strong class="STYLE23 STYLE24">员工基本信息批量导入</strong></p>
          <table width="500" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#FF9900">
          <tr>
            <td align="center" bgcolor="#FFFFFF""><form name="form"
  method="post" action="../admin/admin_jbxxpldr.asp" >
        <p align="center" class="STYLE1">您必须选择由模板录入的excel文件,否则不能成功导入!</p>
        <p>
          <input type="hidden" name="filepath" value="导入的Excel文件/基本信息">
          <input type="hidden"
  name="act" value="upload">
          <input type="file" name="file1"
  size="45">
        </p>
        <p align="center">
          <input
  type="submit" name="Submit" value="导入Excel记录" class="tl">
          <br>
          <br>
        </p>
        <p class="STYLE20">
        要求:Excel必须按模板一样的排版,</p>
        <p class="STYLE20"align="left"><font color="#CC0000">Excel文件名可以不与模版名一致,但是工作表名、工作表中的数据格 
          式都必须与模版中的一致,否则不能成功导入! </font> </p>
            </form> </td>
          </tr>
</table>
<p align="center"><a href="../admin/临朐农信员工基本信息表.xls">点击此处下载<span class="STYLE1">Excel</span>模板录入数据</a></p>
<p align="center"> </p>
</body>
</html>
上面是批量导入的表单部分
下面是批量导入的程序处理部分
<!-- #include file="../include/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("临朐农信员工基本信息表.xls")&";Extended Properties=Excel 8.0"
xlsconn.open xlsstr 
Set xlsrs = Server.CreateObject("Adodb.RecordSet")
sql = "Select * from [临朐农信员工基本信息表$]"
xlsrs.open sql,xlsconn,1,3
If xlsrs.eof Then
else
    i=1
       response.write"<div align='center'>"
    response.write "<TABLE border=1>"
    Do While not xlsrs.eof 
    ygh=xlsrs("员工号")
    dw=xlsrs("单位")
    xm=xlsrs("姓名")
       xb=xlsrs("性别")
       csny=xlsrs("出生年月")
       cjgzsj=xlsrs("参加工作时间")
       jszc=xlsrs("技术职称")
       byyx=xlsrs("毕业院校")
       ks=xlsrs("科室")
    %>
        <TR>
        <TD> <%=ygh%></TD>
        <TD> <%=dw%></TD>
        
        <TD> <%=xm%></TD>
              <TD> <%=xb%></TD>
              <TD> <%=csny%></TD>
    
              <TD> <%=cjgzsj%></TD>
    
              <TD> <%=jszc%></TD>
              <TD> <%=byyx%></TD>
              <TD> <%=ks%></TD>
                
    </TR>
    <%
    
     sql="insert into info(员工号,单位,姓名,性别,出生年月,参加工作时间,技术职称,毕业院校,科室) values('"&ygh&"','"&dw&"','"&xm&"','"&xb&"','"&csny&"','"&cjgzsj&"','"&jszc&"','"&byyx&"','"&ks&"')"
     conn.execute(sql)
     i=i+1 
     xlsrs.movenext
        Loop
  
    response.write "</table>"
End If
xlsrs.close
xlsconn.close
Response.write "共导入<font color='red'>" & i-1 & "</font>条记录.<br>" & vbCrLf
response.write"</div>"
set xlsrs=nothing 
set xlsconn=nothing 
%>