从文本文件中读取信息并存储入数据库
<%
dim fso,f1
Const ForReading = 1
set fso=createobject("Scripting.FileSystemObject")
''使用fso对象读取信息。
set f1=fso.OpenTextFile("E:\doit\info2.txt", ForReading)
''打开要读取的文件
dim conn,rst
set conn=server.createobject("adodb.connection")
''建立数据库连接,执行操作
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循环体插入数据
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
%>
dim fso,f1
Const ForReading = 1
set fso=createobject("Scripting.FileSystemObject")
''使用fso对象读取信息。
set f1=fso.OpenTextFile("E:\doit\info2.txt", ForReading)
''打开要读取的文件
dim conn,rst
set conn=server.createobject("adodb.connection")
''建立数据库连接,执行操作
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循环体插入数据
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
%>
相关推荐
bleach00 2020-11-10
林德强之原创 2020-08-13
PlumRain 2020-08-03
bob于 2020-07-26
dataminer 2020-06-25
neverstopforcode 2020-06-18
zxznsjdsj 2020-06-16
langyue 2020-06-13
huangyx 2020-06-11
鲁氏汤包王 2020-06-11
LWLWLiang 2020-05-28
wkwanglei 2020-05-26
Coohx 2020-04-13
thunderstorm 2020-05-09
Andrea0 2020-05-04
数据库工具开发 2020-04-25
tlsmile 2020-04-24