<!--#include file=dbconn.asp-->
<%
function ReadFile(filename)
on error resume next
err.clear
'A method of error correction in 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) ./Folder stored in the record book
if err.number<>0 then
The response.Write directory does not exist
response.End
end if
'filename=test.txt ------------------test.txt is the file name you read from 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) %>