jasonhahad 发布留言 2008-10-19 16:20
求救!help!(asp生成XML)问题....高手请进!!!
我做了个asp生XML的页面问题如下.
当这样写
<%
xmlfile=server.mappath("pantechs.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("")
MyFile.WriteLine("
")
'一级目录生成
Call Left_Categories
Sub Left_Categories
dim Color,Color2,CSS,CSS2
dim prs2
rs.Open "select * from shop_anclass order by anclassidorder ",conn,1,1
do while not rs.eof
set prs2=conn.execute("select * from shop_nclass where anclassid="&rs("anclassid")&" order by nclassidorder")
MyFile.WriteLine("")
'二级目录生成
if not prs2.eof then
do while not prs2.eof
MyFile.WriteLine("")
'产品生成
'产品生成完毕
MyFile.WriteLine("")
'二级目录生成完毕
'一级目录生成完毕
prs2.movenext
loop
end if
prs2.close
set prs2=nothing
MyFile.WriteLine("")
rs.movenext
loop
rs.close
End sub
'生成完毕
MyFile.WriteLine("/")
MyFile.WriteLine("")
pidone=""
pid=int(request("pid"))
pid2=int(request("pid2"))
pidone=pid
if pid<>"" then
c="where anclassid="&pid&" "
end if
if pid2<>"" and pid2<>0 then
d=" and nclassid="&pid2
end if
pname2=trim(Request("word"))
if pname2<>"" then
c="where SMT_cpname like '%"&pname2&"%' "
end if
id=request("id")
if id<>"" then
c="where SMT_sortid="&id&" "
end if
if request("sale")="sale" then
c="where SMT_newsbook=1 "
end if
set vrs=server.createobject("adodb.recordset")
if pidone<>"" and pidone<>0 then
vrs.open "select * from SMT_cp "&c&" "&d&" order by top, SMT_cpname ",conn,1,1
elseif pname2<>"" then
vrs.open "select * from SMT_cp "&c&" order by top ",conn,1,1
else
vrs.open "select * from SMT_cp order by top ",conn,1,1
end if
if vrs.recordcount=0 then
'fuck
else
iCount=rs.RecordCount'记录总数
iPageSize=rs.PageSize
maxpage=rs.pageCount
page=request("page")
vrs.AbsolutePage=Page
x=iPageSize
For vdssi=1 To x
if vrs.EOF or vrs.BOF then exit for
id=request("id")
MyFile.WriteLine("
")
MyFile.WriteLine("")
vrs.movenext
next
end if
vrs.close
set vrs=nothing
MyFile.Close
%>
的时候会生成
/
当这样写
<%
xmlfile=server.mappath("pantechs.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("")
MyFile.WriteLine("
")
'一级目录生成
Call Left_Categories
Sub Left_Categories
dim Color,Color2,CSS,CSS2
dim prs2
rs.Open "select * from shop_anclass order by anclassidorder ",conn,1,1
do while not rs.eof
set prs2=conn.execute("select * from shop_nclass where anclassid="&rs("anclassid")&" order by nclassidorder")
MyFile.WriteLine("")
'二级目录生成
if not prs2.eof then
do while not prs2.eof
MyFile.WriteLine("")
'产品生成
pidone=""
pid=int(request("pid"))
pid2=int(request("pid2"))
pidone=pid
if pid<>"" then
c="where anclassid="&pid&" "
end if
if pid2<>"" and pid2<>0 then
d=" and nclassid="&pid2
end if
pname2=trim(Request("word"))
if pname2<>"" then
c="where SMT_cpname like '%"&pname2&"%' "
end if
id=request("id")
if id<>"" then
c="where SMT_sortid="&id&" "
end if
if request("sale")="sale" then
c="where SMT_newsbook=1 "
end if
set vrs=server.createobject("adodb.recordset")
if pidone<>"" and pidone<>0 then
vrs.open "select * from SMT_cp "&c&" "&d&" order by top, SMT_cpname ",conn,1,1
elseif pname2<>"" then
vrs.open "select * from SMT_cp "&c&" order by top ",conn,1,1
else
vrs.open "select * from SMT_cp order by top ",conn,1,1
end if
if vrs.recordcount=0 then
'fuck
else
iCount=rs.RecordCount'记录总数
iPageSize=rs.PageSize
maxpage=rs.pageCount
page=request("page")
vrs.AbsolutePage=Page
x=iPageSize
For vdssi=1 To x
if vrs.EOF or vrs.BOF then exit for
id=request("id")
MyFile.WriteLine("")
MyFile.WriteLine("")
vrs.movenext
next
end if
vrs.close
set vrs=nothing
'产品生成完毕
MyFile.WriteLine("")
'二级目录生成完毕
'一级目录生成完毕
prs2.movenext
loop
end if
prs2.close
set prs2=nothing
MyFile.WriteLine("")
rs.movenext
loop
rs.close
End sub
'生成完毕
MyFile.WriteLine("/")
MyFile.WriteLine("")
MyFile.Close
%>
的时候就出错,只能显示
/
就没有了.
我不知道是不是嵌套循环的时候出错.
我对asp不是很熟悉.清高手指点迷津
jasonhahad 发布留言 2008-10-19 16:27
注:其实两次都有写的.只是弟一次复制少了..没办法改.
sunfishy 发布留言 2008-10-19 16:28
代码多.帮顶.
页: [1]