1、1.登录界面: using System; using System.Data; using System.Configuration; 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; public partial class _Default : System.Web.
2、UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { string Name = TextBox1.Text; string Pwd = TextBox2.Text; if (Name== "admin" && Pwd== "123") { Respon
3、se.Redirect("mainpage.aspx"); } } 2.图书信息添加: protected void Button1_Click(object sender, EventArgs e) { SqlConnection sqlCon = new SqlConnection(); sqlCon.ConnectionString = "Data Source=XP-201209212054\\SQLEXPRESS;Initial Catalog=LibraryM;Integrated Security=
4、True"; sqlCon.Open(); string bkId = this.TextBox1.Text; string bkName = this.TextBox2.Text; string bkType = this.DropDownList1.Text; string writer = this.TextBox3.Text; string storage = this.TextBox4.Text; string s = "insert into bookInf
5、o(bookId,bookName,bookType,writer,storage) values('" + bkId + "','" + bkName + "','" + bkType + "','" + writer + "'," + storage + ")"; SqlCommand com = new SqlCommand(s, sqlCon); int i = com.ExecuteNonQuery(); Response.Redirect("bookInformation.aspx"); protected void Bu
6、tton2_Click(object sender, EventArgs e) { this.TextBox1.Text = ""; this.TextBox2.Text = ""; this.DropDownList1.Text = ""; this.TextBox3.Text = ""; } 3.图书归还:CSS样式: body{margin:0px; padding:0px; text-align:center; background-color:#CCFFFF;} #page{m
7、argin-left:auto; margin-right:auto; width:778px;} #left{margin:0px; padding:0px; } #left ul{margin:0px; list-style:none;} #left ul li{font-family:Arial, Helvetica, sans-serif; float:left; width:140px; height:30px;} #head{width:778px;margin-left:auto; margin-right:auto;} #text{width:778px;margin
8、left:auto; margin-right:auto; line-height:130%;} 4.读书信息添加: { SqlConnection con = new SqlConnection(); con.ConnectionString = "Data Source=XP-201209212054\\SQLEXPRESS;Initial Catalog=LibraryM;Integrated Security=True"; con.Open(); string s = "insert into
9、readInfo(ID ,name, Dpartment,class) values('" + this.TextBox1.Text + "','" + this.TextBox2.Text + "','" + this.DropDownList1.Text + "','" + this.TextBox3.Text + "')"; SqlCommand com = new SqlCommand(s, con); int j = com.ExecuteNonQuery(); Response.Redirect("readerInformat
10、ion.aspx"); } protected void Button2_Click(object sender, EventArgs e) { this.TextBox1.Text = ""; this.TextBox2.Text = ""; this.DropDownList1.Text = ""; this.TextBox3.Text = ""; } 1.登陆界面和首页两个界面: 2.图书信息添加:






