yaronbb
Posts: 44 Joined: 10/5/2006 Status: offline
|
XML with ASP as RSS - 8/27/2008 20:05:49
Hi to all, I have trying to add a RSS page (XML) to a web site with connection to the DB(Access), this is my code below, I get an error MSG “ A name was started with an invalid character. Line: 1 Character: 2 <% response.contentType = "text/xml" %> thanks <% response.contentType = "text/xml" %>
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
<title>title</title>
<description>description</description>
<link>link</link>
<%
Dim oConn, oRS, strSQL
Set oConn = Server.CreateObject("ADODB.Connection")
Set oRS = Server.CreateObject("ADODB.Recordset")
oConn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("fpdb/Contact.mdb")
strSQL="SELECT * FROM IcaCar"
oRS.Open strSQL, oConn, 2, 3
Do While Not oRS.EOF
Dim xmlString
oRecordSet.Open sSQLString,oConnectionObject
While Not oRecordSet.Eof
xmlString = xmlString & "<item>" &_
"<title><![CDATA[" & oRecordSet.Fields("title") & "]]></title>" &_
"<description><![CDATA[" & oRecordSet.Fields("description") & "]]></description>" &_
"<link>" & Server.URLEncode(oRecordSet.Fields("link")) & "</link>" &_
"<pubDate>" & oRecordSet.Fields("date") & "</pubDate>" &_
"</item>"
oRecordSet.MoveNext
Wend
oRecordSet.Close
response.write xmlString
%></channel></rss>
|