zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    C语言本身并不提供输入输出语句
    大数据
    kdd cup 论文
    决策树比较
    推荐系统
    geohash
    MySQLdb 安装
    天池大数据比赛
    逻辑回归
    矩阵分解
  • 原文地址:https://www.cnblogs.com/zerogo/p/2209077.html
Copyright © 2011-2022 走看看