您好,欢迎访问一九零五行业门户网

C# RSS生成(后台代码)

前台:就一句话 %@ page language=c# codefile=rss.aspx.cs inherits=rss % ----------------------------------------------------------------------------------------------------------------- 后台代码: string strrss = ; protected void page
前台:就一句话
-----------------------------------------------------------------------------------------------------------------
后台代码:
string strrss = ;
    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
*/
其它类似信息

推荐信息