专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »Asp教程 » asp数据导入:ASP数据导入进度 »正文

asp数据导入:ASP数据导入进度

来源: 发布时间:星期六, 2009年3月28日 浏览:0次 评论:0


直想写个ASP数据导入进度例子今天终于写好了发出来给大家看看不好多保护啊呵呵
<!--#file=\"inc/dsn.asp\"-->
<!--#file=\"inc/vbfun.asp\"-->
<formname=\"data\"action=\"\"id=\"data\">
<inputname=\"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\")
gz_year=\"\"then
gz_year=year(now)
end
gz_month=\"\"then
gz_month=month(now)
end
excelurl<>\"\"then
rs=server.CreateObject(\"adodb.record\")
strexcel=\"provider=Microsoft.Jet.OLEDB.4.0;DataSource=\"&server.MapPath(excelurl)&\";ExtendedProperties=Excel8.0\"
connexcel=CreateObject(\"ADODB.Connection\")
connexcel.Openstrexcel
Sql=\"select*from[sheet1$]\"
rs.OpenSql,connexcel
IFrs.EofAndRs.BofThen
response.Write(\"alert(’没有资料可以导入!’);\")

Conn.BeginTrans
rsf=server.CreateObject(\"adodb.record\")
rsf.open(\"select*fromgz_inforwheregz_year=\"&gz_year&\"andgz_month=\"&gz_month&\"\"),conn
notrsf.eofthen
response.write\"alert(’在这个月中您已经导入了次工资以免重复请核对该次操作作废!’);</script>\"
response.End
end
dowhilenotrs.eof
%>
document.data.showdata.value=\"<%=\"用户名:\"&rs(1)&\"账号:\"&rs(0)%>\";
<%
process=rs(0)
’OnErrorResumeNext
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)
conn.Errors.Count>0then
conn.Errors.Clear [Page]
conn.RollBackTrans
response.write\"<script>alert(导入过程中出现该次操作作废!’);history.back;</Script>\"
response.End
end
rs.movenext
loop
Conn.CommitTrans
response.Write(\"alert(’成功导入用户资料’);\")
end

%>
document.data.showdata.value=\"数据导入完毕\";
<%

%>
window.alert(\"你没有选择任何文件\");
document.data.showdata.value=\"你没有选择任何文件\";
<%
end
%>
</script>
0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: