您正在使用 IPV4 [44.200.169.48] 访问本站,您本次已经查看了 1 页
用户名: 密 码: 验证码:     用QQ登录本站
首页 软件 编程 笑话 知识 公告 台风 日历 计算器
[公益]保护绿色环境,构建和谐社会       悟空收录网      

【腾讯云】 爆款2核2G3M云服务器首年 61元,叠加红包再享折上折      
[公益] 地球是我家,绿化靠大家      
2024年 清明节 006
2024年 劳动节 033
2025年 元 旦 278
2025年 春 节 306
 
您现在的位置:首页 >> ASP/ASP.net >> 内容
本类新增
本类热门
ASP读取CSV文件 并添加到数据库
内容摘要: % set conn=Server.CreateObject('ADODB.Connection') conn.Provider='Microsoft.Jet.OLEDB.4.0' dbpath=Server.MapPath('qipu.mdb') conn.Open dbpath strFileName = Request.QueryString('fil......
<%

set conn=Server.CreateObject("ADODB.Connection")

conn.Provider="Microsoft.Jet.OLEDB.4.0"

dbpath=Server.MapPath("qipu.mdb")

conn.Open dbpath

strFileName = Request.QueryString("file1")

set rs = Server.CreateObject("ADODB.recordset")

Dim Fso

Dim myFile

Dim titleindex

Dim cateindex

Dim picindex

Dim detailindex

dim arr()

Set Fso = Server.CreateObject("Scripting.FileSystemObject")

Set myFile = Fso.OpenTextFile(Server.MapPath("1111.csv"),1,True,-1)

'A.TXT和ASP程序在同个目录下,如果没在一个目录,可以用绝对路径,把上一行的a.txt改为:d:\a.txt

%>

<table border="1">

<%

myNum=0

While Not myFile.AtEndOfStream

If myNum = 0 Then

row=Split(myFile.ReadLine," ")

for i=0 to ubound(row)

MyVar=row(i)

Select Case MyVar

Case "Loxiu.com名称" titleindex= i

Case "宝贝类目" cateindex=i

Case "新图片" picindex=i

End Select

next

End If

row=Split(myFile.ReadLine," ")

%>

<tr>

<%

'for i=0 to ubound(row)

'td=row(i)

title=row(titleindex)

pic=row(picindex)

cate=row(cateindex)

sql="insert into product(title,pic,cate) values('"&title&"','"&pic&"','"&cate&"')"

rs.Open sql, conn

%>

<td ><div style="overflow:hidden; width:200px; height:30px;" ><%=title%></div></td><td ><div style="overflow:hidden; width:200px; height:30px;" ><%=pic%></div></td><td ><div style="overflow:hidden; width:200px; height:30px;" ><%=cate%></div></td>

<%

'next

%>

</tr>

<%

myNum=myNum+1

Wend

myFile.Close

Set myFile = Nothing

Set Fso = Nothing

%>

</table>

版权声明:本内容来源于网络,如有侵犯您的版权,请联系站长,本站收到您的信息后将及时处理。
上一篇:asp中实现replace不区分大小写的替换方法

 

下一篇:自动获取当前页面URL的

发布日期:2021/6/15
手机扫二维码直达本页
发布时间:12:34:56
点  击:5
录  入:壹家怡园
相关文章
Baidu
YiJiaCMS 7.3.8 build231228(MSSQL) 闽ICP备05000814号-1
本空间由腾讯云(轻量应用服务器)提供,Cloudflare提供加速防护
运行时间载入中.....