首页 > php教程 > php手册 > 正文

C# RSS生成(后台代码)

php中文网
发布: 2016-06-06 20:01:40
原创
1382人浏览过

前台:就一句话 %@ Page Language="C#" CodeFile="rss.aspx.cs" Inherits="rss" % ----------------------------------------------------------------------------------------------------------------- 后台代码: string strRSS = ""; protected void Page

   前台:就一句话

 

 

-----------------------------------------------------------------------------------------------------------------

 

后台代码:

 

 

 

 string strRSS = "";

NoCode
NoCode

美团推出的零代码应用生成平台

NoCode 200
查看详情 NoCode

    protected void Page_Load(object sender, EventArgs e)
    {
 Response.ContentType = "application/xml"; // 输出并按xml数据显示
 Response.Write(GetRSS());
    }

    ///


    /// 取得聚合文章
    ///

      public string GetRSS()
    {
 //DataSet ds = gr.GenerateRSS(); // 调用GenerateRSS()方法,获得数据
 strRSS = strRSS + "";
 strRSS = strRSS + "";
 strRSS = strRSS + "";
 strRSS = strRSS + "";
 strRSS = strRSS + "学习社区";
 strRSS = strRSS + "http://218.106.183.120/";
 strRSS = strRSS + "Copyright (c) 学习社区";
 strRSS = strRSS + "Latest 20 threads";
 strRSS = strRSS + "Discuz!NT";
 strRSS = strRSS + "Fri, 27 Mar 2009 16:21:08 GMT";
 strRSS = strRSS + "60";
 using (scn = new SqlConnection())
 {
     scn.ConnectionString = "server=.;uid=sa;pwd=111111;database=pubs;";
     scn.Open();
     using (sda = new SqlDataAdapter())
     {
  sda.SelectCommand = scn.CreateCommand();
  sda.SelectCommand.CommandText = "select * from jobs";
  sda.SelectCommand.ExecuteNonQuery();
  DataSet ds = new DataSet();
  sda.Fill(ds);
  if (ds != null && ds.Tables[0].Rows.Count > 0)
  {
      foreach (DataRow dr in ds.Tables[0].Rows)
      {
   strRSS = strRSS + "";
   strRSS = strRSS + "" + dr["job_desc"].ToString().Trim() + "";
   strRSS = strRSS + "http://www.com-edu.cn "; //标题链接
   strRSS = strRSS + "";
   strRSS = strRSS + "土人制造";
   strRSS = strRSS + "" + dr["min_lvl"].ToString().Trim() + "";
   strRSS = strRSS + "http://www.com-edu.cn";  //注释链接
   strRSS = strRSS + "
";
      }
  }
     }
 }
 strRSS = strRSS + "
";
 strRSS = strRSS + "
";

 return strRSS;
    }

 

 

rss2.0参考

    /*
     
 学习社区
 http://218.106.183.120/
 Latest 20 threads
 Copyright (c) 学习社区
 Discuz!NT
 Fri, 27 Mar 2009 16:21:08 GMT
 60
 
   关于北京市高等教育自学考试2009年7月考试报考工作安排的通知
 

    一、注册、报考、缴费时间

    2009年4月15日至25日,逾期不予办理。
    ]]>


   http://218.106.183.120/showtopic-6.aspx
   社区公告
   风中竹影
   Tue, 24 Mar 2009 09:35:00 GMT
 
     
   
    */

相关标签:
php
最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门推荐
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号