navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

ASP page converts MS SQL database to xml feed

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> ASP page converts MS SQL database to xml feed
Page: [1]
 
xx75vulcan

 

Posts: 25
Joined: 1/6/2006
From: Wildwood MO
Status: offline

 
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]

All Forums >> Web Development >> ASP and Database >> ASP page converts MS SQL database to xml feed
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts