ASP page converts MS SQL database to xml feed (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


xx75vulcan -> ASP page converts MS SQL database to xml feed (10/16/2006 15:13:37)

Howdy,

I have created an ASP page that will "on the fly" create an XML feed from my MS SQL database and the contents within a specified table.

The Feed: http://www.rockwood.k12.mo.us/news/rss.asp

You won't be able to see the code, b/c it returns xml, so I copied it below.

The Problem:
I can get every value to return from the database except the value that goes into the "Description" tag in the xml. (Ex: title, link and date all return fine. The Database column called "Summary" is supposed to return into the "description" tag in the xml, but comes back empty - no error, just empty.)

The column value of "summary" is of datatype "ntext", but so is the "title" column, which returns just fine.

Example database record that it’s pulling back:
http://www.rockwood.k12.mo.us/news/releases/displayfullstory.asp?Key=932
In this example, it’s pulling back the bold title as “title”, the italicized date as “date” and the story text as the “description” (which is coming back blank in the xml)


Full ASP code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<% Response.Buffer = true
Response.ContentType = "text/xml"

Function ApplyXMLFormatting(strInput)
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")

ApplyXMLFormatting = strInput
End Function
%>

<rss version="2.0">
<channel>
<title>News Releases from Rockwood School District</title>
<link>www.rockwood.k12.mo.us</link>
<description>The Rockwood School District is St. Louis County largest public school system, serving about 22,000 students.As we pursue our goal to provide a world-class education to all of our students, we remain committed to continuous improvement and increased student achievement. </description>
<language>en-us</language>
<copyright>Copyright 2006 Christopher Beeson
All Rights Reserved.</copyright>

<%

Dim strReferrer
strReferrer = Request.QueryString("strReferrer")
Dim intPage
Dim intPageCount
Dim intRecord
Dim itest
Dim Key


'Get current Date for AddNew Form
Dim CurrentDate
CurrentDate = Date

'Create and Open Connection Object
Set objConnection = Server.CreateObject("ADODB.Connection")

' Open the data source connection
objConnection.Open "dsn=Releases;uid=Removed;pwd=Removed;"

'Create and Open Recordset Object
set RsList = Server.CreateObject("ADODB.Recordset")
RsList.ActiveConnection = objConnection
RsList.CursorType = adOpenDynamic
'RsList.LockType = adLockOptimistic
RsList.Source = "MAIN"
RsList.Open

If Not rslist.EOF Then
Do Until rslist.EOF

%>


<item>
<title><%=ApplyXMLFormatting(RsList("title").Value)%></title><link>http://www.rockwood.k12.mo.us/news/releases/displayfullstory.asp?Key=<%=RsList("key")%></link><description><%=ApplyXMLFormatting(RsList("summary"))%></description><datePosted><%=ApplyXMLFormatting(RsList("date"))%></datePosted></item><%
rslist.MoveNext
Loop
End IF

%></channel></rss>




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
4.699707E-02