bookselect.aspx.cs

来自「简单的图书的管理系统」· CS 代码 · 共 52 行

CS
52
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
public partial class Bookselect : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        String strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("book.mdb");
        OleDbConnection con = new OleDbConnection(strCon);
        OleDbCommand cmd = con.CreateCommand();
        cmd.CommandText = "select * from Book";
        con.Open();
        OleDbDataReader dr = cmd.ExecuteReader();
        Label1.Text = "<table border='1'><tr bgcolor='#ABCDEF'><td>书名</td><td>作者</td><td>出版社</td><td>介绍</td> <td>注册时间</td></tr>";
        while (dr.Read())
        {
            if (TextBox1.Text.ToString() == dr["Bookname"].ToString() && TextBox2.Text.ToString() == dr["Booktitle"].ToString())
            {
                Label1.Text += "<tr>";
                Label1.Text += "<td>" + dr["Bookname"] + "</td>";
                Label1.Text += "<td>" + dr["Booktitle"] + "</td>";
                Label1.Text += "<td>" + dr["Bookpublish"] + "</td>";
                Label1.Text += "<td>" + dr["Bookintro"] + "</td>";
                Label1.Text += "<td>" + dr["BookisBn"] + "</td>";
                Label1.Text += "<td>" + dr["Booktime"] + "</td>";
                Label1.Text += "</tr>";

            }

           
        }
        con.Close();
      
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Redirect("Bookinsert.aspx");
    }
}

⌨️ 快捷键说明

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