数据量再大也可以。
1)先从数据库中把数据读出记录,保存到变量中:
val1=rs("field1")
val2=rs("field2")
...
valn=rs("fieldn")
2)然后用fso的writeline方法写入文本文件:
<%
Set AFileSystemObject = CreateObject("Scripting.FileSystemObject")
Set ATextStream = AFileSystemObject.CreateTextFile("C:\test\test.txt",true)
ATextStream.WriteLine(val1)
ATextStream.WriteLine(val2)
...
ATextStream.WriteLine(valn)
ATextStream.Close
on error resume next
if err<>0 then
Response.write "错误:"&err.Description
else
Response.write "数据库写入完毕!"
end if
%>