这个asp生成静态文件的代码哪有错误啊?急

yingzihack 2010-07-06 11:27:00
<!--#include file="conn.asp"-->
<%
dim title,content,id

if reguest("id")="" then
id=0
else
id=reguest("id")

Dim fso,f,htmlpath,mobanpath,tmppath
Dim strTitle,strContent,strOut
'创建文件系统对象
htmlpath=Server.MapPath("html")
mobanpath=Server.MapPath("cmoban.html")
Set fso=Server.CreateObject("Scripting.FileSystemObject")

Set f=fso.OpenTextFile(Server.MapPath("cmoban.html")) '打开网页模板文件,读取模板内容
strOut=f.ReadAll
f.close

set rs=server.CreateObject("ADODB.RecordSet")
rs.Source="select top 50 * from jingdian where id > " & id & "by order by id"
rs.Open rs.Source,Conn,1,1


Do While not rs.eof '貌似这个循环有问题。不过不知道怎么错的
tmppath = htmlpath & "\" & rs("s_id") & "\" &rs("o_id") '定义路径
if not fso.folderExists(tmppath) then
fso.creasteFolder(tmppath) '创建文件夹
end if
title=rs("title")
content=rs("content")
strTitle = title
strContent= content
strOut=Replace(strOut,"$title$",strTitle) '替换strOut字符串中的$title$
strOut=Replace(strOut,"$xiangqing$",strContent) '替换
Set f=fso.CreateTextFile(tmppath&"\" & rs("id") & ".html") '创建要生成的静态页
f.WriteLine strOut '写入网页内容
f.close ' 关闭文件对象
set f=Nothing '释放文件系统对象
if not rs.eof then
rs.movenext '移到下一个记录
end if

Loop
id=rs("id") '记录当前已创建了的ID值用于下页更新
rs.close
set rs=nothing

set fso=Nothing
%>
<%
Response.Write ("已更新了" & id & "个景点信息!")
%>


<script language="javascript">
location="updataall.asp?id=<% = id %> " ;
</script>

...全文
70 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ChinaXtHuLang 2010-07-07
  • 打赏
  • 举报
回复
1,4,5楼加起来就可以了。
lzp4881 2010-07-07
  • 打赏
  • 举报
回复
if reguest("id")="" then
id=0
else
后面没有end if


if not rs.eof then
rs.movenext '移到下一个记录
end if
这个判断是多余的,你前面的do while not rs.eof就已经帮你判断了


Loop
id=rs("id")
循环完了,记录集已经到最后了,这个时候再取rs("id")还取得到吗?
scc1980 2010-07-06
  • 打赏
  • 举报
回复
if reguest("id")="" then
id=0

。。。。。。
。。。

没有对应的 end if
yingzihack 2010-07-06
  • 打赏
  • 举报
回复
我吧两处都改了 还是不可以。。
技术信息(用于支持人员)

错误类型:
Microsoft VBScript 编译器错误 (0x800A03F6)
缺少 'End'
/all.asp, 第 59 行


浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

网页:
GET /all.asp
yingzihack 2010-07-06
  • 打赏
  • 举报
回复
恩恩 是的 不过循环有问题吗?
yudoggy 2010-07-06
  • 打赏
  • 举报
回复
大概浏览了一下 发现两个问题
1. reguest 应为 request

2. "select top 50 * from jingdian where id > " & id & "by order by id" 里面order 前面的by应该不需要

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧