1. Introduction
RSS is also called aggregate RSS, which is an easy way to share content online.
Usually use RSS subscriptions in time-sensitive internals to obtain information more quickly. The website provides RSS output is conducive to allowing users to obtain the latest updates of website content.
Second, simple configuration (no three layers)
1, create a table for books in the Test database, and store some book records
create table BookList( BookID int identity(1,1) primary key, BookName nvarchar(100) not null, BookDate datetime, BookAuthor nvarchar(100), BookISBN nvarchar(50) , BookDescription nvarchar(500))
随便插两条记录
2、在项目中添加
Book实体类
public class Book{ public int BookID {get; set;} public string BookName {get; set;} public DateTime BookDate {get; set ;} public string BookAuthor {get; set;} public string BookISBN {get; set;} public string BookDescription {get; set; }}
Book business class
public class BookManager{ //Get the book collection public ListGetBookList() {DataTable dt = new DataTable(); string constr = "server=.;database=studentdb;uid=sa;pwd =123456"; string cmdText = "select * from booklist"; using (SqlConnection conn = new SqlConnection(constr)) {using (SqlCommand cmd = new SqlCommand(cmdText, conn)) {using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) {sda.Fill(dt);}}} return DTToList(dt);} //Convert the DataTable object to the Book collection public List DTToList(DataTable dt) {List list = new List (); foreach (DataRow dr in dt.Rows) {Book book = new Book( ); book.BookAuthor = dr["BookAuthor"].ToString(); DateTime bookdate = new DateTime(); DateTime.TryParse(dr["BookDate"].ToString(),out bookdate); book.BookDate = bookdate; book.BookDescription = dr["BookDescription"].ToString(); int bookid = 0; int.TryParse(dr["BookID"].ToString(),out bookid); book.BookID = bookid; book.BookISBN = dr ["BookISBN"].ToString(); book.BookName = dr["BookName"].ToString(); list.Add(book);} return l ist; }}
In WebForm1.aspx
<%@ Page Language="C# "AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="RSSApp.WebForm1" %>XXX bookstore This is a Very good bookstore zh-cn <%=strbooks %>
In WebForm2.aspx.cs
< pre name="code" class="csharp">protected string strbooks;protected void Page_Load(object sender, EventArgs e){ BookManager bll = new BookManager(); List