從文本文件中讀取信息并存儲(chǔ)入數(shù)據(jù)庫(kù)
更新時(shí)間:2006年10月28日 00:00:00 作者:
''===================================================================
''從文本文件中讀取信息,取其中的一部分,并且將其插入到數(shù)據(jù)庫(kù)中去……
'' xhony@163.com
'' version 1.0
''===================================================================
<%
dim fso,f1
Const ForReading = 1
set fso=createobject("Scripting.FileSystemObject")
''使用fso對(duì)象讀取信息。
set f1=fso.OpenTextFile("E:\doit\info2.txt", ForReading)
''打開(kāi)要讀取的文件
dim conn,rst
set conn=server.createobject("adodb.connection")
''建立數(shù)據(jù)庫(kù)連接,執(zhí)行操作
set rst=server.createobject("adodb.recordset")
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.mappath("db1.mdb")
rst.activeconnection=conn
dim fread
do while not f1.atEndOfStream
''用do... loop循環(huán)體插入數(shù)據(jù)
fread=f1.readline
line=split(fread,":::")
rst.source="insert into barcode1(barcode1) values ("&trim(line(0))&")"
rst.open
loop
f1.close
conn.close
''''all over
%>
''從文本文件中讀取信息,取其中的一部分,并且將其插入到數(shù)據(jù)庫(kù)中去……
'' xhony@163.com
'' version 1.0
''===================================================================
<%
dim fso,f1
Const ForReading = 1
set fso=createobject("Scripting.FileSystemObject")
''使用fso對(duì)象讀取信息。
set f1=fso.OpenTextFile("E:\doit\info2.txt", ForReading)
''打開(kāi)要讀取的文件
dim conn,rst
set conn=server.createobject("adodb.connection")
''建立數(shù)據(jù)庫(kù)連接,執(zhí)行操作
set rst=server.createobject("adodb.recordset")
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Server.mappath("db1.mdb")
rst.activeconnection=conn
dim fread
do while not f1.atEndOfStream
''用do... loop循環(huán)體插入數(shù)據(jù)
fread=f1.readline
line=split(fread,":::")
rst.source="insert into barcode1(barcode1) values ("&trim(line(0))&")"
rst.open
loop
f1.close
conn.close
''''all over
%>
相關(guān)文章
從文本文件中讀取信息并存儲(chǔ)入數(shù)據(jù)庫(kù)
從文本文件中讀取信息并存儲(chǔ)入數(shù)據(jù)庫(kù)...2006-10-10
用asp實(shí)現(xiàn)的代碼批量修改程序,fso相關(guān)
用asp實(shí)現(xiàn)的代碼批量修改程序,fso相關(guān)...2006-10-10
一個(gè)實(shí)用的FSO-實(shí)時(shí)統(tǒng)計(jì)在線人數(shù)
一個(gè)實(shí)用的FSO-實(shí)時(shí)統(tǒng)計(jì)在線人數(shù)...2006-10-10
NAV導(dǎo)致IIS調(diào)用FSO失敗的解決方法
NAV導(dǎo)致IIS調(diào)用FSO失敗的解決方法...2006-10-10

