System.FormatException: Input string was not in a correct format.
for the line:
Dim feedXML As XmlDocument = CType(Cache("channel" + channelID), XmlDocument)
Expand|Select|Wrap|Line Numbers
- <%@ Import Namespace="System.Web.UI.WebControls" %>
- <%@ Import Namespace="System.Data" %>
- <%@ Import Namespace="System.Data.SqlClient" %>
- <%@ Import Namespace="System.Xml" %>
- <%@ Import Namespace="System.Xml.xsl" %>
- <%@Page Language="VB" debug="True"%>
- <script language="vb" runat="server">
- Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
- Dim channelID As Integer
- if Request.QueryString("channelID")="" then channelID=0 else channelID=Int32.Parse(Request.QueryString("channelID"))
- Dim feedXML As XmlDocument = CType(Cache("channel" + channelID), XmlDocument)
- If feedXML Is Nothing Then
- Dim myConnection As SqlConnection = New SqlConnection("connect stuff;")
- Dim SQL_QUERY As String = "SELECT URL, UpdateInterval FROM its.dbo.xTblRssChannels WHERE channelID = @channelID"
- Dim myCommand As SqlCommand = New SqlCommand(SQL_QUERY, myConnection)
- Dim feedParam As SqlParameter = New SqlParameter("@channelID", SqlDbType.Int, 4)
- feedParam.Value = channelID
- myCommand.Parameters.Add(feedParam)
- myConnection.Open
- Dim reader As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
- reader.Read
- Dim feedURL As String = reader("URL").ToString
- Dim updateInterval As Integer = Int32.Parse(reader("UpdateInterval").ToString)
- myConnection.Close
- feedXML = New XmlDocument
- feedXML.Load(feedURL)
- Cache.Insert("channel" + channelID, feedXML, Nothing, DateTime.Now.AddMinutes(updateInterval), TimeSpan.Zero)
- End If
- xmlNewsItems.Document = feedXML
- Dim xsltArgList As Xsl.XsltArgumentList = New XsltArgumentList
- xsltArgList.AddParam("channelID", "", channelID)
- xmlNewsItems.TransformArgumentList = xsltArgList
- End Sub
- </script>
- <script language="javascript">
- // display a blank page in the bottom frame when the news items loads
- parent.rbottom.location.href = "about:blank";
- </script>
- </head>
- <body>
- <form id="Form1" method="post" runat="server">
- <asp:Xml id="xmlNewsItems" runat="server" TransformSource="rssItems.xslt"></asp:Xml>
- </body>
- </HTML>