手机
当前位置:查字典教程网 >编程开发 >ASP教程 >FSO 读出TXT文件
FSO 读出TXT文件
摘要:

<>

<%

function ReadFile(filename)

on error resume next

err.clear

'ASP的一种校错方法

Const ForReading = 2

Const Create = false

Dim FSO

DIM TS

DIM filepath

DIM thefile

Dim content

'---------------操作地址

Set FSO=server.createobject("scripting.filesystemobject")

filepath=server.MapPath("temp") ./记录本存放的文件夹

if err.number<>0 then

response.Write "目录不存在"

response.End

end if

'filename="test.txt" ---------test.txt为你从数据库里读出的文件名

thefile=filepath&"/"&filename

Set TS = FSO.OpenTextFile(thefile,1)

do until Ts.AtEndOfStream

Response.Write (""&TS.ReadLine&"")

response.write("<br>")

loop

Set TS = Nothing

Set FSO = Nothing

end function

%>

<%

dim id

dim filename

id=6

Set rs=Server.CreateObject("ADODB.Recordset")

sql="select * from yuan where id="&id

rs.open sql,cn,1,1

filename=rs("fileload")

%>

<% readfile(filename) %>

【FSO 读出TXT文件】相关文章:

FSO文件对象介绍及常用函数

强制刷新和判断文件地址

通过数组给您的文件排序

奇妙的文件系统对象组件

用ASP实现远程批量文件改名

asp代码实现access数据导出到excel文件

读取目录下的文件得到一个数组

TsysV1.1 系统文件清单介绍

FSO一些代码

ASP输出生成Word 、Excel、Txt文件的方法

精品推荐
分类导航