asp分行读取txt文件,有分隔符,存储到access

txt文件是下面这样的,
一行一条数据,用逗号分隔
下面写出asp文件
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="inc/conn.asp" -->
<%
filespec=server.mappath("txt.txt")
Const ForReading = 1
Dim fso, theFile, retstring
Set fso = CreateObject("Scripting.FileSystemObject")
Set theFile = fso.OpenTextFile(filespec, ForReading, False)
i=0
Do While theFile.AtEndOfStream <> True
session("line"&i) = theFile.ReadLine
i=i+1
Loop
theFile.Close
ReadEntireFile = retstring
for j=0 to i-1
arry=split(session("line"&j),",")
'arry(0),arry(1),arry(2)
'分别为:张三 男 30岁
'然后进行数据存储
set rs3=server.createobject("adodb.recordset")
sql="select * from keywords"
rs3.open sql,conn,3,3
rs3.addnew
rs3("text")=arry(0)
rs3("url")=arry(1)
rs3.update

response.write session("line"&j)+"<br>"
next
%>

原文地址:http://www.corange.cn/archives/2010/05/3626.html

转载于:https://www.cnblogs.com/ajuanabc/archive/2010/05/25/2462731.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值