日本精品久久久久中文字幕8|久久国产精品九九国产精品|伊人久久综合无码成人网|偷拍视频一区二区三区,日本一区二区三区三级视频,国产精品一区二区不卡的视频,中文字幕精品乱码亚洲一区

Amaze UI

最新簽單 新聞中心 互聯(lián)網(wǎng) 物聯(lián)網(wǎng) 移動(dòng)互聯(lián)網(wǎng) IT基礎(chǔ)服務(wù)

全部信息    APP    微信公眾號(hào)    手機(jī)網(wǎng)站   

網(wǎng)站首頁(yè) >> 移動(dòng)互聯(lián)網(wǎng)相關(guān) >> 手機(jī)網(wǎng)站

asp實(shí)現(xiàn)將excel中的數(shù)據(jù)批量導(dǎo)入到access

...


asp數(shù)據(jù)批量導(dǎo)入的原理是使用excel保存許多數(shù)據(jù),然后將這個(gè)excel使用無(wú)組件上傳到服務(wù)器上,然后打開excel,將里面的數(shù)據(jù)寫入到數(shù)據(jù)庫(kù)中。
這里我寫的是將excel中的數(shù)據(jù)讀出來,然后寫入到數(shù)據(jù)庫(kù)中
具體代碼:
<!-- #include file="adoconn.asp" -->
< %

’連接excel數(shù)據(jù)庫(kù)
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 
sql = "Select * from ["&file2&"$]"
xlsrs.open sql,xlsconn,1,1 
If xlsrs.eof Then
else
i=1
response.write "<TABLE border=1>"
Do While not xlsrs.eof 
goods_name=xlsrs("商品名")
goods_images=xlsrs("圖片")
cat_id=xlsrs("商品分類")
%>

<TR>
   <TD>&nbsp;<%=goods_name%></TD>
   <TD>&nbsp;<%=goods_images%></TD>  
   <TD>&nbsp;<%=cat_id%></TD> 
</TR>
<% 
sql="insert into goods(goods_name,goods_images,cat_id) values(’"&goods_name&"’,’"&goods_images&"’,"&cat_id&")"
conn.execute(sql)
i=i+1 
xlsrs.MoveNext
    Loop 
response.write "</table>"
End If
xlsrs.close
Response.write "共導(dǎo)入<font color=’red’>" & i-1 & "</font>條記錄.<br>" & vbCrLf
set xlsconn=nothing 
set objCmd=Nothing
% >

上一條:網(wǎng)站建設(shè)-SQL 求和技巧

下一條:ASP字符串函數(shù)大全

扬中市| 奎屯市| 沂南县| 上栗县| 山阳县| 云安县| 青川县| 株洲市| 台北市| 临汾市| 济南市| 柯坪县| 乾安县| 台中县| 秀山| 宜宾市| 元朗区| 嵊州市| 定西市| 双牌县| 五河县| 东乡族自治县| 琼结县| 于都县| 泰州市| 紫云| 名山县| 横峰县| 饶河县| 桦甸市| 新巴尔虎右旗| 吉首市| 临泽县| 乐业县| 古浪县| 保康县| 明溪县| 赤水市| 从化市| 汝城县| 宜良县|