FSO <!--#include file= "dbconn.asp"-->
<%
function ReadFile (filename)
On Error Resume Next
Err.Clear
' An error-correction method for ASP
Const ForReading = 2
Const Create = False
Dim FSO
DIM TS
DIM filepath
DIM thefile
Dim Content
'---------------operation address
Set fso=server.createobject ("Scripting.FileSystemObject")
Filepath=server. MapPath ("temp")./notebook folder for storage
If Err.number<>0 Then
Response. Write "Directory does not exist"
Response. End
End If
' Filename= ' test.txt '---------test.txt the file name you read out of the database
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)%>