FSO 读出TXT文件

(编辑:jimmy 日期: 2024/9/22 浏览:2)

<!--#include file="dbconn.asp"-->
<%
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) %>


一句话新闻
Windows上运行安卓你用过了吗
在去年的5月23日,借助Intel Bridge Technology以及Intel Celadon两项技术的驱动,Intel为PC用户带来了Android On Windows(AOW)平台,并携手国内软件公司腾讯共同推出了腾讯应用宝电脑版,将Windows与安卓两大生态进行了融合,PC的使用体验随即被带入到了一个全新的阶段。