您当前的位置: 首页 > 网站编程 > ASP教程 > Asp技术实现数据导入进度状态的显示代码

Asp技术实现数据导入进度状态的显示代码

作者:不详 来源:网络 发布时间: 2011-10-14 11:54 点击:
本文采用Asp技术实现数据导入进度状态的显示,代码如下: !--#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(

Asp技术实现数据导入进度状态的显示代码

  本文采用Asp技术实现数据导入进度状态的显示,代码如下:
  
  <!--#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=Excel8.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>0then
  
  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>

分享到:
本文"Asp技术实现数据导入进度状态的显示代码"由远航站长收集整理而来,仅供大家学习与参考使用。更多网站制作教程尽在远航站长站。
顶一下
(0)
0%
踩一下
(0)
0%
[点击 次] [返回上一页] [打印]
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
关于本站 - 联系我们 - 网站声明 - 友情连接- 网站地图 - 站点地图 - 返回顶部
Copyright © 2007-2013 www.yhzhan.com(远航站长). All Rights Reserved .
远航站长:为中小站长提供最佳的学习与交流平台,提供网页制作与网站编程等各类网站制作教程.
官方QQ:445490277 网站群:26680406 网站备案号:豫ICP备07500620号-4