asp实现将excel中的数据批量导入到accesshttp://www.aspprogram.cn 21:40:46 aspprogram.cn
asp数据批量导入的原理是使用excel保存许多数据,然后将这个excel使用无组件上传到服务器上,然后打开excel,将里面的数据写入到数据库中。
无组件上传见:http://www.aspprogram.cn/html/soft/2008624191142.html
这里我写的是将excel中的数据读出来,然后写入到数据库中
具体代码:
<!-- #include file="adoconn.asp" -->
< %
'===========================================
' 函数功能:数据批量导入
' 作 者:wangsdong
' 网 站: http://www.aspprogram.cn
' 文章为作者原创,转载请注明文章出处、保留作
' 者信息,谢谢支持!
' 原理:将excel中的数据导入到access
'===========================================
'连接excel数据库
path="./"
Dim xlsconn,strsource,xlbook,xlsheet,i
Dim myConn_Xsl,xlsrs,sql,objCmd
Set xlsconn = server.CreateObject("adodb.connection")
Set xlsrs = Server.CreateObject("Adodb.RecordSet")
filename="商品"
file2="商品列表"
source=server.mappath(path&filename&".xls")
myConn_Xsl="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &source& ";Extended Properties=Excel 8.0"
xlsconn.open myConn_Xsl
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载