熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 導航excel數據到mssql access mysql 等數據方法

2022-06-13   來源: .NET編程 

  下面是一段簡單的由asp導入excel數據保存到其它的數據如有mssql access mysql 等哦好了費話不說多了來看看下面的代碼吧

  <!#include file="adoconnasp">
<%
Set xlsconn = serverCreateObject("adodbconnection")
set rs=serverCreateObject("adodbrecordset")

  source=servermappath("")&""&replace(request("path")"/""")
myConn_Xsl="Provider=MicrosoftJetOLEDB;Data Source=" &source& ";Extended Properties=Excel "
xlsconnopen myConn_Xsl

  sql="select * from [商品列表$]"
set rs=xlsconnexecute(sql)
if not rseof then
while not rseof
names=rs("商品名")
pic=rs("圖片")

  sql="insert into [product](namesepic) values("& names &""& pic &")"
connexecute(sql)

  rsmovenext
wend

  end if
responsewrite "導入成功"
end if
%>

  數據連接文件<!#include file="adoconnasp">

  set rs=serverCreateObject("adodbrecordset")
db="/database/dbmdb"
set conn=serverCreateObject("adodbconnection")
connstr="Provider=MicrosoftJetOLEDB;Data Source=" & ServerMapPath(db)
connopen connstr


From:http://tw.wingwit.com/Article/program/net/201311/14100.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.