试图从asp制作RSS源 [英] trying to make an RSS feed from asp
问题描述
您好,
我正在尝试从asp制作者页面浏览RSS页面。我一直收到以下错误:
此页面包含以下错误:第102行第102行错误
错误:打开和结束标记不匹配:字体行0和描述
下面是第一个错误之前的页面呈现。
test1 http://www.test.com/RSS.aspx test2 Vacaturenummer:Vacaturenummer Functie:Vacature Omschrijving
这是我的代码:
RSS.aspx.cs文件:
受保护 void GetChatmsg ( int SVID, int RVID)
{
尝试
{
使用(SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = spr_Visitor_View_UserC hatMsgs跨度>;
cmd.Parameters.AddWithValue( @ SVID,SVID.ToString());
cmd.Parameters.AddWithValue( @ RVID,RVID.ToString());
// System.Data.DataTable dt = DBHelper.SqlExecuteReader(cmd);
RSS.DataSource = DBHelper.SqlExecuteReader(cmd);
RSS.DataBind();
}
}
catch (例外情况)
{
抛出 ex;
}
}
私有 void Page_Load( System。 Object sender,System.EventArgs e)
{
_vacatureID = Request.QueryString( id);
Connection();
<跨度类= 代码注释> // 跨度> <跨度类= 代码注释>的SelectCommand Vacature Samenstellen 跨度>
_selectCommandVacature.CommandText = <跨度类=代码串 >跨度> <跨度类= 代码串> SELECT Vacature_id,Vacature_functie,Vacature_datum,Vacature_tekst FROM Vacature WHERE Vacature_laatste_vacaturestatus = 1 OR Vacature_laatste_vacaturestatus = 4 ORDER BY Vacature_datum DESC跨度>;
_selectCommandVacature.Connection = _con;
尝试 {
_con.Open();
_dataReader = _selectCommandVacature.ExecuteReader();
while (_ datataader.Read){
LbLVacatureOmschrijving.Text = welkom1;
LblVacaturenr.Text = welkom 2 ;
// LblVacaturenr2.Text = _dataReader(vacature_id)。ToString()
}
} 最后 {
_con.Close();
}
rss.aspx文件:
<%@ 页 语言 = C# ContentType = text / xml AutoEventWireup = true CodeBehind = RSS.aspx.cs %>
< rss version = 2.0 >
< 频道 >
< title > test1 < /标题 >
< link > http://www.test.com/RSS.aspx < / link >
< de script ion >
test2
< / de script ion >
< item >
< title > < font class = tableclass > Vacaturenummer:< / font > < asp:label id = LblVacaturenr runat = server > Vacaturenummer < / asp:label > < / title >
&l t; de script ion > < font class = tableclass > 功能:< asp:label id = LbLVacatureOmschrijving runat = 服务器 > Vacature Omschrijving < / asp:label > < / de script ion > ;
< / item >
< / channel >
< / rss < span class =code-keyword>>
rss.aspx似乎是正确的,因为我几乎从另一个文件复制它。
但我不知道如何处理RSS.aspx.cs文件,如果有人能帮助我,我会非常感激。
亲切的问候,
Dennis
您已经复制了部分解决方案,您需要使用转发器控制然后将数据绑定到它。
引用:
http://www.c-sharpcorner.com/UploadFile/9444a3/create-rss-feed-using-Asp-Net/ [ ^ ]
http://code.tutsplus.com/articles/how-to -build-an-rss-feed-with-aspnet-net-16136 [ ^ ]
http://msdn.microsoft.com/en-us/library/aa478968.aspx [ ^ ]
http://www.aspsnippets.com/Articles/Create-and-add-dynamic-RSS-Feed-from-Database-in-ASPNet-Website.aspx [< a href =http://www.aspsnippets.com/Articles/Create-and-add-dynamic-RSS-Feed-from-Database-in-ASPNet-Website.aspx\"target =_ blanktitle =New Window > ^ ]
Hello,
I am trying to page an RSS page from asp maker. I keep getting the following error:
This page contains the following errors:
error on line 18 at column 102: Opening and ending tag mismatch: font line 0 and description
Below is a rendering of the page up to the first error.
test1 http://www.test.com/RSS.aspx test2 Vacaturenummer: Vacaturenummer Functie: Vacature Omschrijving
Here are my codes:
The RSS.aspx.cs file:
protected void GetChatmsg(int SVID, int RVID)
{
try
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "spr_Visitor_View_UserChatMsgs";
cmd.Parameters.AddWithValue("@SVID", SVID.ToString());
cmd.Parameters.AddWithValue("@RVID", RVID.ToString());
//System.Data.DataTable dt = DBHelper.SqlExecuteReader(cmd);
RSS.DataSource = DBHelper.SqlExecuteReader(cmd);
RSS.DataBind();
}
}
catch (Exception ex)
{
throw ex;
}
}
private void Page_Load(System.Object sender, System.EventArgs e)
{
_vacatureID = Request.QueryString("id");
Connection();
//Selectcommand Vacature Samenstellen
_selectCommandVacature.CommandText = "SELECT Vacature_id,Vacature_functie,Vacature_datum,Vacature_tekst FROM Vacature WHERE Vacature_laatste_vacaturestatus=1 OR Vacature_laatste_vacaturestatus=4 ORDER BY Vacature_datum DESC";
_selectCommandVacature.Connection = _con;
try {
_con.Open();
_dataReader = _selectCommandVacature.ExecuteReader();
while (_dataReader.Read) {
LbLVacatureOmschrijving.Text = welkom1;
LblVacaturenr.Text = welkom 2;
//LblVacaturenr2.Text = _dataReader("vacature_id").ToString()
}
} finally {
_con.Close();
}
The rss.aspx file:
<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeBehind="RSS.aspx.cs" %>
<rss version="2.0">
<channel>
<title>test1</title>
<link>http://www.test.com/RSS.aspx</link>
<description>
test2
</description>
<item>
<title><font class="tableclass">Vacaturenummer:</font> <asp:label id="LblVacaturenr" runat="server">Vacaturenummer</asp:label></title>
<description><font class="tableclass">Functie: <asp:label id="LbLVacatureOmschrijving" runat="server">Vacature Omschrijving</asp:label></description>
</item>
</channel>
</rss>
The rss.aspx seems to be right, since I almost copied it from another file.
But I have no idea what to do with the RSS.aspx.cs file, if anyone could help me I would really appreciate it.
Kind regards,
Dennis
you have copied part of the solution, you need to use repeater control and then bind the data to it.
references:
http://www.c-sharpcorner.com/UploadFile/9444a3/create-rss-feed-using-Asp-Net/[^]
http://code.tutsplus.com/articles/how-to-build-an-rss-feed-with-aspnet--net-16136[^]
http://msdn.microsoft.com/en-us/library/aa478968.aspx[^]
http://www.aspsnippets.com/Articles/Create-and-add-dynamic-RSS-Feed-from-Database-in-ASPNet-Website.aspx[^]
这篇关于试图从asp制作RSS源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!