 |
聯(lián)系人:李先生 |
電 話:029-87878512 |
手 機(jī):13468700578 |
地 址:西安市絲路國(guó)際創(chuàng)意夢(mèng)工廠4號(hào)樓 |
在線咨詢: |
762176615 |
Email:junsoft@126.com |
|
 |
|
|
|
將Excel數(shù)據(jù)快速大批量導(dǎo)入Access數(shù)據(jù)庫(kù)的代碼 |
 |
發(fā)布者:西安軟件公司 發(fā)布時(shí)間:2020/9/7 閱讀:次 |
 |
在做項(xiàng)目時(shí),經(jīng)常遇到要將Excel中的大量數(shù)據(jù)導(dǎo)入到Access數(shù)據(jù)庫(kù)中,原來(lái)的做法是讀一條寫(xiě)一條,若導(dǎo)入上萬(wàn)條的數(shù)據(jù)需要幾分仲時(shí)間,速度很慢。有沒(méi)有最快的方法呢?經(jīng)本人研究、反復(fù)的實(shí)驗(yàn),終于寫(xiě)出了最快速的批量導(dǎo)入大批量數(shù)據(jù)的方法,上萬(wàn)條數(shù)據(jù)只需幾秒鐘就可全部導(dǎo)入. Set conn = Server.CreateObject("adodb.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=" & Server.MapPath("test.mdb") conn.Open connstr sql = "insert into userinfo select userName,userAccount,userStatus from [userinfo$] in ’" & Server.MapPath("hbwlUserInfo.xls") & "’ ’Excel 8.0;’ where userAccount is not null" conn.Execute (sql)
|
|