|
<!-- #include file="inc/dsn.asp" --> <!--#include file="inc/vbfun.asp"--> <form name="data" action="" id="data"> <input name="showdata" type="text" value="数据 加载中..." size="100"> </form> <script> <% excelurl=request.Form("file_url") gz_year=request.Form("gz_year") gz_month=request.Form("gz_month") if gz_year="" then gz_year=year(now()) end if if gz_month="" then gz_month=month(now()) end if if excelurl<>"" then set rs=server.CreateObject("adodb.recordset") strexcel="provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.MapPath(excelurl)&";Extended Properties=Excel 8.0" set connexcel=CreateObject("ADODB.Connection") connexcel.Open strexcel Sql="select * from [sheet1$]" rs.Open Sql,connexcel IF rs.Eof And Rs.Bof Then response.Write("alert ('没有资料可以导入!');") else Conn.BeginTrans set rsf=server.CreateObject("adodb.recordset") rsf.open("select * from gz_infor where gz_year="&gz_year&" and gz_month="&gz_month&"") ,conn if not rsf.eof then response.write "alert('在这个月中您已经导入了一次工资以免重复请核对,该次操作作废!');</script>" response.End() end if do while not rs.eof %> document.data.showdata.value="<%="用户名:"&rs(1)&" 账号:"&rs(0)%>"; <% process=rs(0) ' On Error Resume Next conn.execute("importgz '"&rs(0)&"','"&rs(1)&"','"&rs(2)&"','"&rs(3)&"','"&rs(4)&"','"&rs(5)&"','"&rs(6)&"','"&rs(7)&"','"&rs(8)&"','"&rs(9)&"','"&rs(10)&"','"&rs(11)&"','"&rs(12)&"','"&rs(13)&"','"&rs(14)&"','"&rs(15)&"','"&rs(16)&"','"&rs(17)&"',"&gz_year&","&gz_month) if conn.Errors.Count>0 then conn.Errors.Clear conn.RollBackTrans response.write "<script>alert(导入过程中出现错误,该次操作作废!');history.back();</Script>" response.End() end if rs.movenext loop Conn.CommitTrans response.Write("alert('成功导入用户资料');") end if %> document.data.showdata.value="数据导入完毕"; <% else %> window.alert("你没有选择任何文件"); document.data.showdata.value="你没有选择任何文件"; <% end if %> </script>
|
一共有 0 条评论