一段asp代码,大家帮我调试一下,谢谢

来源:百度知道 编辑:UC知道 时间:2024/06/03 23:05:14
<%
dim objfile
dim objstream
dim fn
dim st1
set objfile=Server.CreateObject("Scripting.FileSystemObject")
'创建一个名为objfile的Scripting.FileSystemObject对象实例
if(not objfile.fileExists(Server.MapPath("\data.txt")))then
'判断data.txt是否存在,不存在则创建
set objstream=objfile.createtextfile(Server.MapPath("\data.txt"),true)
objstream.writeline()
set objstream=nothing
else
'读出先前data.txt中的内容
set pre=objfile.opentextfile(Server.MapPath("\data.txt"))
if not pre.atendofstream then
st1=pre.readall
end if
pre.close
end if

'读表单数据
dim st2
st2=request.Form("1")&":"&"<br>"&request.Form("2")

'将st1,st2写入data.txt
dim objstream1
set objstream1=objfile.c

在头部加一个
On Error Resume Next
On Error Resume Next 会使程序按照产生错误的语句之后的语句继续执行,或是按照最近一次所调用的过程(该过程含有 On Error Resume Next 语句)中的语句继续运行

有关txt文件的操作:
建立一个data.txt的文件
读出data.txt文件的内容
判断一个data.txt文件是否存在
请你参考下面的网址内容,一般能解决问题。
http://www.leletiankong.com