这段asp生成xml 那里错了?哪位大哥帮帮忙啊

寒叶gg 2009-10-02 09:29:14
<!--#include file="conn.asp"--><!--#include file="sqlin.asp"--><?xml version="1.0" encoding="gbk"?>
<%
Request_id=Request("aa")
sql="select id,bookhtml,bookupdateid,bookupdatetitle from Ws_BookList where "&Request_id&" 1=1"
set rs = server.CreateObject ("adodb.recordset")
rs.open sql,conn,1,1
%>
<DOCUMENT>
<item>
<key><%=rs("booktitle")%></key>
<display>
<url><![CDATA[http://www.56xs.net/book/<%=rs("id")%>/index.aspx]]></url>
<title><%=rs("booktitle")%>-56小说网</title>
<showurl><![CDATA[www.56xs.net/book/<%=rs("id")%>/index.aspx]]></showurl>
<pagesize>17k</pagesize>
<date>2009-10-02</date>
<content1>56免费小说阅读网提供<%=rs("bookwriter")%>的<%=rs("booktitle")%>最新章节<%=rs("bookupdatetitle")%>在线阅读,并提供<%=rs("booktitle")%>TXT、CHM、UMD、JAR、JAD电子书免费下载 ...</content1>
<link linkurl="http://www.56xs.net<%=rs("bookhtml")%><%=rs("id")%>/index.shtml" linkcontent="<%=rs("booktitle")%>目录" />
<link linkurl="http://www.56xs.net<%=rs("bookhtml")%><%=rs("id")%>/<%=rs("bookupdateid")%>.shtml" linkcontent="<%=rs("bookupdatetitle")%>" />
</display>
</item>
</DOCUMENT>


提示
Microsoft OLE DB Provider for SQL Server 错误 '80040e14'

第 1 行: '1' 附近有语法错误。

输出xml提示
应有一个字符串文字, 但找不到左引号。处理资源 'http://www.56xs.net/xxx/go.asp?aa=22' 时出错。第 2 行,位置: 23


是晓得我那里错了.... 我是想用参数查询数据库并输出xml 参数aa就是一个id
...全文
70 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
后浪 2009-10-03
  • 打赏
  • 举报
回复
[Quote=引用楼主 ckhker 的回复:]
VB code<!--#include file="conn.asp"--><!--#include file="sqlin.asp"--><?xml version="1.0" encoding="gbk"?><%
Request_id=Request("aa")
sql="select id,bookhtml,bookupdateid,bookupdatetitle from Ws_BookList where"&Request_id&" 1=1"set rs= server.CreateObject ("adodb.recordset")
rs.open sql,conn,1,1
%><DOCUMENT><item><key><%=rs("booktitle")%></key><display><url><![CDATA[http://www.56xs.net/book/<%=rs("id")%>/index.aspx]]></url><title><%=rs("booktitle")%>-56小说网</title><showurl><![CDATA[www.56xs.net/book/<%=rs("id")%>/index.aspx]]></showurl><pagesize>17k</pagesize><date>2009-10-02</date><content1>56免费小说阅读网提供<%=rs("bookwriter")%>的<%=rs("booktitle")%>最新章节<%=rs("bookupdatetitle")%>在线阅读,并提供<%=rs("booktitle")%>TXT、CHM、UMD、JAR、JAD电子书免费下载 ...</content1><link linkurl="http://www.56xs.net<%=rs("bookhtml")%><%=rs("id")%>/index.shtml" linkcontent="<%=rs("booktitle")%>目录"/><link linkurl="http://www.56xs.net<%=rs("bookhtml")%><%=rs("id")%>/<%=rs("bookupdateid")%>.shtml" linkcontent="<%=rs("bookupdatetitle")%>"/></display></item></DOCUMENT>

提示
Microsoft OLE DB Provider for SQL Server 错误 '80040e14'

第 1 行: '1' 附近有语法错误。

输出xml提示
应有一个字符串文字, 但找不到左引号。处理资源 'http://www.56xs.net/xxx/go.asp?aa=22' 时出错。第 2 行,位置: 23


是晓得我那里错了.... 我是想用参数查询数据库并输出xml 参数aa就是一个id
[/Quote]能这样写xml???
寒叶gg 2009-10-03
  • 打赏
  • 举报
回复
事实上我就这么写了... 刚才的问题已经解决...sql查询语句错了
hookee 2009-10-02
  • 打赏
  • 举报
回复

<%
Response.ContentType = "text/xml"
%><?xml version="1.0" encoding="gbk"?>
<!--#include file="conn.asp"-->
<!--#include file="sqlin.asp"-->
<%
Request_id = Request("aa")
sql = "select id,bookhtml,bookupdateid,bookupdatetitle from Ws_BookList where id=" & Request_id
set rs = CreateObject("adodb.recordset")
rs.open sql,conn,1,1
Set oDoc = CreateObject("Msxml2.DOMDocument")
Set root = oDoc.createElement("DOCUMENT")
Set item = oDoc.createElement("item")
Set key = oDoc.createElement("key")
key.text = rs("booktitle").Value
item.appendChild key

Set display = oDoc.createElement("display")
Set url = oDoc.createElement("url")
s = "http://www.56xs.net/book/" & rs("id").Value & "/index.aspx"
Set cdata = oDoc.createCDATASection(s)
url.appendChild cdata
display.appendChild url

Set title = oDoc.createElement("title")
title.text = rs("booktitle").Value & "-56小说网"
display.appendChild title

Set showurl = oDoc.createElement("showurl")
s = "www.56xs.net/book/" & rs("id").Value & "/index.aspx"
Set cdata = oDoc.createCDATASection(s)
showurl.appendChild cdata
display.appendChild showurl

Set pagesize = oDoc.createElement("pagesize")
pagesize.text = "17k"
display.appendChild pagesize

Set date1 = oDoc.createElement("date")
date1.text = "2009-10-02"
display.appendChild date1

Set content1 = oDoc.createElement("content1")
content1.text = "56免费小说阅读网提供" & rs("bookwriter").Value & "的" & rs("booktitle").Value & "最新章节" & rs("bookupdatetitle").value & "在线阅读,并提供" & rs("booktitle").value & "TXT、CHM、UMD、JAR、JAD电子书免费下载 ..."
display.appendChild content1

Set link = oDoc.createElement("link")
link.setAttribute "linkurl", "http://www.56xs.net" & rs("bookhtml") & rs("id") & "/index.shtml"
link.setAttribute "linkcontent", rs("booktitle") & "目录"
display.appendChild link

Set link1 = oDoc.createElement("link")
link1.setAttribute "linkurl", "http://www.56xs.net" & rs("bookhtml") & rs("id") & "/" & rs("bookupdateid") & ".shtml"
link1.setAttribute "linkcontent", rs("bookupdatetitle")
display.appendChild link1

item.appendChild display
root.appendChild item

Response.Write root.xml
%>

hookee 2009-10-02
  • 打赏
  • 举报
回复
<%
Response.ContentType = "text/xml"
%><?xml version="1.0" encoding="gbk"?>
<!--#include file="conn.asp"-->
<!--#include file="sqlin.asp"-->
<%
Request_id = Request("aa")
sql = "select id,bookhtml,bookupdateid,bookupdatetitle from Ws_BookList where id=" & Request_id
set rs = CreateObject("adodb.recordset")
rs.open sql,conn,1,1
Set oDoc = CreateObject("Msxml2.DOMDocument")
Set root = oDoc.createElement("DOCUMENT")
Set item = oDoc.createElement("item")
Set key = oDoc.createElement("key")
key.text = rs("booktitle").Value
item.appendChild key

Set display = oDoc.createElement("display")
Set url = oDoc.createElement("url")
s = "http://www.56xs.net/book/" & rs("id").Value & "/index.aspx"
Set cdata = oDoc.createCDATASection(s)
url.appendChild cdata
display.appendChild url

Set title = oDoc.createElement("title")
title.text = rs("booktitle").Value & "-56小说网"
display.appendChild title

Set showurl = oDoc.createElement("showurl")
s = "www.56xs.net/book/" & rs("id").Value & "/index.aspx"
Set cdata = oDoc.createCDATASection(s)
showurl.appendChild cdata
display.appendChild showurl

Set pagesize = oDoc.createElement("pagesize")
pagesize.text = "17k"
display.appendChild pagesize

Set date1 = oDoc.createElement("date")
date1.text = "2009-10-02"
display.appendChild date1

Set content1 = oDoc.createElement("content1")
content1.text = "56免费小说阅读网提供" & rs("bookwriter").Value & "的" & rs("booktitle").Value & "最新章节" & rs("bookupdatetitle").value & "在线阅读,并提供" & rs("booktitle").value & "TXT、CHM、UMD、JAR、JAD电子书免费下载 ..."
display.appendChild content1

Set link = oDoc.createElement("link")
link.setAttribute "linkurl", "http://www.56xs.net" & rs("bookhtml") & rs("id") & "/index.shtml"
link.setAttribute "linkcontent", rs("booktitle") & "目录"
display.appendChild link

Set link1 = oDoc.createElement("link")
link1.setAttribute "linkurl", "http://www.56xs.net" & rs("bookhtml") & rs("id") & "/" & rs("bookupdateid") & ".shtml"
link1.setAttribute "linkcontent", rs("bookupdatetitle")
display.appendChild link1

item.appendChild display
root.appendChild item

Response.Write root.xml
%>

28,406

社区成员

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

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