⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 begin.aspx.cs

📁 自己写的一个网上图书馆 可实现图书上传借阅等功能
💻 CS
字号:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Begin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        

        //绑定推荐版
        SqlConnection Conn = new SqlConnection("server=(local);database=e_library;uid=sa;pwd=");
        Conn.Open();
        string StrSql = "select top 10 * from Book_Info order by B_RentCount desc";
        SqlDataAdapter Da = new SqlDataAdapter(StrSql, Conn);
        DataSet Ds = new DataSet();
        Da.Fill(Ds);
        DataList_Detail0.DataSource = Ds.Tables[0];
        DataList_Detail0.DataBind();
        Conn.Close();


        //绑定排行版

        Conn.Open();
        StrSql = "select top 10 * from Book_Info order by B_Count desc";
        Da = new SqlDataAdapter(StrSql, Conn);
        Ds = new DataSet();
        Da.Fill(Ds);
        DataList_Detail.DataSource = Ds.Tables[0];
        DataList_Detail.DataBind();
        Conn.Close();
    }



    protected void Button_HomePage_Click(object sender, EventArgs e)
    {
        Response.Redirect("HomePage.aspx");
    }
    protected void Button_Novel_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='小说'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_Poetry_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='诗歌'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_ForiegnLiterature_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='外国文学'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_PhilosophyReligion_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='哲学宗教'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_PoliticsEconomics_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='政治经济'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_EnglishReading_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='英语读物'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_ComputerBooks_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='电脑书籍'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_MathPhysicsChemistry_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info a,Book_Style b,Book_DetailStyle c where B_S_Name='数理化'  and b.B_S_ID=c.B_S_ID and a.B_BDS_ID=c.B_DS_ID";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
    protected void Button_All_Click(object sender, EventArgs e)
    {
        string StrSql = "select * from Book_Info";
        Session["StrSql"] = StrSql;
        Response.Redirect("Massage.aspx");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -