AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Problem with RSS
Posted by Robert Woltz on  2/9/2009 4:04:08 PM Category: ADO.NET
Add to my favorites
Email to friend
Can anyone help me here. I know it's reading the db but it will not display. Here is the code.

I have tried several things as you might be able to tell my all the commendted out lines.

Thank you in advance for any help.

RTW

The code (VB)

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim sqlCon As String = System.Configuration.ConfigurationManager.AppSettings("MSIdbConnectionString")
'Dim spName As String = System.Configuration.ConfigurationManager.AppSettings("sp_name")

Response.Clear()
Response.ContentType = "text/xml"

Dim xml As XmlTextWriter = New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
xml.WriteStartDocument()

'Dim cmd As New SqlCommand("Select * FROM RSSjo", New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString))

'cmd.Connection.Open()
'Dim dr As SqlDataReader = cmd.ExecuteReader()

Dim sqlString As String = "SELECT * FROM [RSSjo]"

Dim myDa As New SqlDataAdapter(sqlString, sqlCon)
Dim myDt As New DataTable()
myDa.Fill(myDt)
Dim i As Integer
i = 0

xml.WriteStartElement("rss")
xml.WriteAttributeString("version", "2.0")

xml.WriteStartElement("channel")

xml.WriteElementString("title", "All Opportunities")
xml.WriteElementString("link", "http://www.nursesinshape.com")
xml.WriteElementString("description", "WOW what a test")

' Do While dr.Read()


Do While i < myDt.Rows.Count
xml.WriteStartElement("Item")

xml.WriteElementString("title", myDt.Rows(i).ToString())
xml.WriteElementString("link", myDt.Rows(i).ToString())
xml.WriteElementString("description", myDt.Rows(i).ToString())
xml.WriteElementString("category", myDt.Rows(i).ToString())
xml.WriteElementString("managingEditor", myDt.Rows(i).ToString())
xml.WriteEndElement()
i = i + 1
MsgBox("Hello")
Loop


'Try
'xml.WriteStartElement("Item")

'xml.WriteElementString("title", reader(1).ToString())
'xml.WriteElementString("link", reader(2).ToString())
'xml.WriteElementString("description", reader(3).ToString())
'xml.WriteElementString("category", reader(4).ToString())
'xml.WriteElementString("managingEditor", reader(5).ToString())
'xml.WriteEndElement()
'i = i + 1
'Loop

'Catch ex As Exception
'MsgBox(ex.Message)

'Ed Try


xml.WriteEndElement()
xml.WriteEndElement()
xml.WriteEndDocument()
xml.Flush()
xml.Close()
Response.End()
'cmd.Connection.Close()

End Sub
End Class

Post Your Reply Post New Question

 Viewer's Reply
This Question has 0 replies.

 
Sponsored by
Simply JavaScript - Free 150 Page Preview!
Web Application Security — How to Minimize Prevalent Risk of Attacks
Take Advantage of Oracle's 2 Day DBA Course