作家
登录

FSO 读出TXT文件

作者: 来源:www.28hudong.com 2013-03-30 08:57:22 阅读 我要评论

<!--#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) %>

  推荐阅读

  ASP 非法字符过滤函数

复制代码 代码如下:<% '==============================================================检查提交数据合法性 Function CheckInput() '--------定义部份------------------ Dim Fy_Post,Fy_Get,Fy_In,Fy_Inf,Fy_>>>详细阅读


本文标题:FSO 读出TXT文件

地址:http://www.17bianji.com/kaifa2/ASP/33035.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)