您好,欢迎来到星星旅游。
搜索
您的当前位置:首页图书管理系统源代码

图书管理系统源代码

来源:星星旅游
附录一代码: 一、惩罚 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"chengfa.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; } .auto-style3 { text-align: right; height: 23px; width: 468px;

background-color: #CCFF66; } .auto-style4 { height: 23px;

background-color: #CCFF66; } .auto-style5 {

background-color: #CCFF66; } .auto-style6 { width: 468px; text-align: right;

background-color: #CCFF66; }

 

惩罚修改

姓名

书名

书号

超出时间

惩罚金钱

    

   

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) { }

protectedvoid Button1_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

string str = \"insert into

punishiment(bname,bn,time,punishment,name)values(@TextBox2,@TextBox3,@TextBox4,@TextBox5,@TextBox1)\";

SqlCommand sqlcom = newSqlCommand(str, con);

sqlcom.Parameters.Add(\"@TextBox1\", SqlDbType.VarChar, 20).Value =

this.TextBox1.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox2\", SqlDbType.VarChar, 20).Value = this.TextBox2.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox3\", SqlDbType.VarChar, 20).Value = this.TextBox3.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox4\", SqlDbType.VarChar, 20).Value = this.TextBox4.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox5\", SqlDbType.VarChar, 20).Value = this.TextBox5.Text.Trim();

sqlcom.ExecuteNonQuery();

Response.Write(\"\");

con.Close(); this.DataBind(); }

protectedvoid Button2_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand shanchu = newSqlCommand(\"delete from punishiment where bname='\" + TextBox2.Text + \"'\", con);

shanchu.ExecuteNonQuery();

Response.Write(\"\"); con.Close(); this.DataBind(); }

protectedvoid Button3_Click(object sender, EventArgs e) {

Response.Redirect(\"首页2.aspx\"); } }

二、修改用户权限

1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"gqx.aspx.cs\"Inherits=\"Default2\"%>

.auto-style1 { width: 100%; height: 5px; margin-bottom: 0px; } .auto-style2 { text-align: left;

background-color: #CCFF66; }

.auto-style3 { height: 23px; background-color: #CCFF66; } .auto-style5 { height: 25px;

background-color: #CCFF66; } .auto-style6 { text-align: right; width: 707px;

background-color: #CCFF66; } .auto-style7 { height: 1px;

background-color: #CCFF66; } .auto-style8 { height: 25px; width: 707px; text-align: right;

background-color: #CCFF66; } .auto-style9 { width: 707px; height: 23px;

text-align: right;

background-color: #CCFF66; }

用户信息  

请输入要修改用户姓名:

      选择权限:

请输入1或者2

         

 

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclassDefault2 : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm1 = newSqlCommand(\"SELECT * from [user]\", con); SqlDataAdapter Adp = newSqlDataAdapter(); Adp.SelectCommand = Cm1; DataSet ds1 = newDataSet(); Adp.Fill(ds1);

DataTable dt1 = ds1.Tables[0]; GridView1.DataSource = dt1; GridView1.DataBind();

GridView1.HeaderRow.Cells[0].Text = \"姓名\"; GridView1.HeaderRow.Cells[1].Text = \"昵称\"; GridView1.HeaderRow.Cells[2].Text = \"性别\"; GridView1.HeaderRow.Cells[3].Text = \"电话\"; GridView1.HeaderRow.Cells[4].Text = \"邮箱\"; GridView1.HeaderRow.Cells[5].Text = \"密码\";

GridView1.HeaderRow.Cells[6].Text = \"权限\";

con.Close(); }

protectedvoid GridView1_SelectedIndexChanged(object sender, EventArgs e) { }

protectedvoid Button1_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + TextBox1.Text + \"'\", con);

SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Session[\"name\"] = TextBox1.Text; Response.Write(\"\"); Dr.Close();

string stri = \"update [user] set[type]=(@TextBox2) where name='\"+TextBox1.Text + \"'\"; SqlCommand sqlcom = newSqlCommand(stri, con);

sqlcom.Parameters.Add(\"@TextBox2\", SqlDbType.VarChar, 20).Value = this.@TextBox2.Text.Trim();

sqlcom.ExecuteNonQuery();

} else {

Response.Write(\"\");

} }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"首页2.aspx\"); }

}

三、借还书 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"jiehuanshu.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; } .auto-style3 { width: 474px;

background-color: #CCFF66; } .auto-style4 { text-align: right;

background-color: #CCFF66; } .auto-style6 { text-align: right; width: 471px;

background-color: #CCFF66; } .auto-style7 {

background-color: #CCFF66; }

 

借还书管理

借书人id:

书号:

书名:

借出时间:

归还时间:

       

\"SelectCommand=\"SELECT [num], [bn], [bname], [lendtime], [returntime] FROM [borrowinfo]\">

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) { }

protectedvoid Button1_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM book,[user] WHERE num='\" + TextBox1.Text + \"'\" + \"or bn='\" + TextBox2.Text + \"';update book set number=number-1 WHERE bn='\" + TextBox2.Text + \"'\", con);

SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Session[\"num\"] = TextBox1.Text; Session[\"bn\"] = TextBox2.Text;

Response.Write(\"\");

Dr.Close(); string str = \"insert into

borrowinfo(num,bn,bname,lendtime,returntime)values(@TextBox1,@TextBox2,@TextBox3,@TextBox4,@TextBox5)\";

SqlCommand sqlcom = newSqlCommand(str, con);

sqlcom.Parameters.Add(\"@TextBox1\", SqlDbType.VarChar, 20).Value = this.TextBox1.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox2\", SqlDbType.VarChar, 20).Value = this.TextBox2.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox3\", SqlDbType.VarChar, 50).Value = this.TextBox3.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox4\", SqlDbType.VarChar, 20).Value = this.TextBox4.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox5\", SqlDbType.VarChar, 20).Value = this.TextBox5.Text.Trim();

sqlcom.ExecuteNonQuery(); } else {

Response.Write(\"\"); Dr.Close();

} }

protectedvoid Button2_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM book,[user] WHERE num='\" + TextBox1.Text + \"'\" + \"or bn='\" + TextBox2 + \"';update book set number=number+1 WHERE bn='\" + TextBox2 + \"'\", con);

SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Session[\"num\"] = TextBox1.Text; Session[\"bn\"] = TextBox2.Text;

Response.Write(\"\");

Dr.Close(); string str = \"insert into

borrowinfo(num,bn,bname,lendtime,returntime)values(@TextBox1,@TextBox2,@TextBox3,@TextBox4,@TextBox5)\";

SqlCommand sqlcom = newSqlCommand(str, con);

sqlcom.Parameters.Add(\"@TextBox1\", SqlDbType.VarChar, 20).Value = this.TextBox1.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox2\", SqlDbType.VarChar, 20).Value = this.TextBox2.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox3\", SqlDbType.VarChar, 50).Value = this.TextBox3.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox4\", SqlDbType.VarChar, 20).Value = this.TextBox4.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox5\", SqlDbType.VarChar, 20).Value = this.TextBox5.Text.Trim();

sqlcom.ExecuteNonQuery(); } else {

Response.Write(\"\"); Dr.Close();

} }

protectedvoid Button3_Click(object sender, EventArgs e) {

Response.Redirect(\"首页2.aspx\"); } }

四、用户注册 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"register.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; } .auto-style2 {

text-align: left;

background-color: #CCFF66; } .auto-style3 { height: 20px; text-align: left;

background-color: #CCFF66; } .auto-style4 { text-align: left; height: 23px;

background-color: #CCFF66; } .auto-style6 { height: 20px; text-align: right; width: 467px;

background-color: #CCFF66; } .auto-style7 { width: 467px;

background-color: #CCFF66; } .auto-style8 { text-align: left; width: 153px;

background-color: #CCFF66; } .auto-style9 { height: 20px; text-align: left; width: 153px;

background-color: #CCFF66; } .auto-style11 { text-align: left; width: 467px; height: 23px;

background-color: #CCFF66; } .auto-style12 { text-align: left; width: 153px; height: 23px;

background-color: #CCFF66; } .auto-style13 { width: 467px; text-align: right;

background-color: #CCFF66; } .auto-style14 { text-align: right; width: 467px; height: 23px;

background-color: #CCFF66; } .auto-style15 {

background-color: #CCFF66; }

 

用户注册  

   用户名:

     id:

    密码:
确认密码:


\"ValidationExpression=\"^(?!(?:[^a-zA-Z]|\\D|[a-zA-Z0-9])$).{8,}$\">

   性别:  

    电话:

\"ValidationExpression=\"(\\(\\d{3}\\)|\\d{3}-)?\\d{8}\">

    邮箱:

\"ValidationExpression=\"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\">

 

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient;

using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) {

UnobtrusiveValidationMode = UnobtrusiveValidationMode.None; }

protectedvoid Button1_Click(object sender, EventArgs e) {

Response.Write(\"\"); }

protectedvoid Button2_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + TxtLoginName.Text + \"'\" + \"or email='\" + TxtEmail.Text + \"'\", con); SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Response.Write(\"\"); Dr.Close(); } else {

Dr.Close();

string str = \"insert into

[user](name,num,sex,phone,email,pwd)values(@TxtLoginName,@TxtNickName,@Sex,@TxtTel,@TxtEmail,@TxtUserRePwd)\";

SqlCommand sqlcom = newSqlCommand(str, con);

MD5CryptoServiceProvider md5Hasher = newMD5CryptoServiceProvider(); UTF8Encoding encoder = newUTF8Encoding();

String enpwd =

Convert.ToBaseString(md5Hasher.ComputeHash(encoder.GetBytes(this.TxtUserPwd.Text.Trim())));

sqlcom.Parameters.Add(\"@TxtLoginName\", SqlDbType.VarChar, 20).Value = this.TxtLoginName.Text.Trim();

sqlcom.Parameters.Add(\"@TxtNickName\", SqlDbType.VarChar, 20).Value = this.TxtNickName.Text.Trim();

sqlcom.Parameters.Add(\"@TxtUserRePwd\", SqlDbType.VarChar, 50).Value = enpwd;

sqlcom.Parameters.Add(\"@TxtEmail\", SqlDbType.VarChar, 20).Value = this.TxtEmail.Text.Trim();

sqlcom.Parameters.Add(\"@TxtTel\", SqlDbType.VarChar, 20).Value = this.TxtTel.Text.Trim();

sqlcom.Parameters.Add(\"@Sex\", SqlDbType.VarChar, 20).Value = this.RadioButtonList1.SelectedValue;

sqlcom.ExecuteNonQuery();

Response.Write(\"\");

}

con.Close(); this.DataBind(); }

protectedvoid RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { } }

五、新书上架 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"xinshu.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; } .auto-style2 { text-align: right;

background-color: #CCFF66; } .auto-style4 { width: 459px;

background-color: #CCFF66; } .auto-style5 { text-align: right; height: 23px;

background-color: #CCFF66; } .auto-style6 { height: 23px;

background-color: #CCFF66; } .auto-style7 {

background-color: #CCFF66; }

 

添加新书

作者

书号

书名

数量

价格

出版时间

位置

   

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) { }

protectedvoid Button1_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open(); string str = \"insert into

book(bn,bname,number,price,location,name,time)values(@TextBox2,@TextBox3,@TextBox4,@Tex

tBox5,@TextBox7,@TextBox1,@TextBox6)\"; SqlCommand sqlcom = newSqlCommand(str, con);

sqlcom.Parameters.Add(\"@TextBox1\", SqlDbType.VarChar, 20).Value = this.TextBox1.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox2\", SqlDbType.VarChar, 20).Value = this.TextBox2.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox3\", SqlDbType.VarChar, 50).Value = this.TextBox3.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox4\", SqlDbType.VarChar, 20).Value = this.TextBox4.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox5\", SqlDbType.VarChar, 20).Value = this.TextBox5.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox6\", SqlDbType.VarChar, 20).Value = this.TextBox6.Text.Trim();

sqlcom.Parameters.Add(\"@TextBox7\", SqlDbType.VarChar, 20).Value = this.TextBox7.Text.Trim();

sqlcom.ExecuteNonQuery();

Response.Write(\"\");

con.Close(); this.DataBind(); }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"首页3.aspx\"); } }

六、管理员管理 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"管理员管理.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; } .auto-style2 { text-align: center; } .auto-style8 { width: 929px; }

             管理员登录           

用户:

密码:

管理员管理







 

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender, EventArgs e) { }

protectedvoid Button5_Click(object sender, EventArgs e) {

Response.Redirect(\"首页3.aspx\"); }

protectedvoid Button6_Click(object sender, EventArgs e) {

Panel1.Visible = false; Panel2.Visible = true;

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

MD5CryptoServiceProvider md5Hasher = newMD5CryptoServiceProvider(); UTF8Encoding encoder = newUTF8Encoding();

String enpwd =

Convert.ToBaseString(md5Hasher.ComputeHash(encoder.GetBytes(this.Pwd.Text.Trim())));

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + Name.Text + \"' AND pwd ='\" + enpwd + \"' \", con);

SqlDataReader Dr = Cm.ExecuteReader();

if (Dr.Read()) {

Session[\"username\"] = Name.Text; Session[\"password\"] = Pwd.Text; string a = Dr[6].ToString(); if(a==\"1\")

{

Response.Write(\"\"); } else

{

Response.Write(\"\"); }

Dr.Close();

} else

{

Response.Write(\"\");

}

con.Close(); }

protectedvoid Button1_Click(object sender, EventArgs e) {

Response.Redirect(\"gqx.aspx\"); }

protectedvoid Button3_Click(object sender, EventArgs e) {

Response.Redirect(\"chengfa.aspx\"); }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"xinshu.aspx\"); } } 七、首页 1、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography;

using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) { }

protectedvoid Button5_Click(object sender, EventArgs e) {

Response.Redirect(\"首页3.aspx\"); }

protectedvoid Button6_Click(object sender, EventArgs e) {

Panel1.Visible = false; Panel2.Visible = true;

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

MD5CryptoServiceProvider md5Hasher = newMD5CryptoServiceProvider(); UTF8Encoding encoder = newUTF8Encoding();

String enpwd =

Convert.ToBaseString(md5Hasher.ComputeHash(encoder.GetBytes(this.Pwd.Text.Trim())));

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + Name.Text + \"' AND pwd ='\" + enpwd + \"' \", con);

SqlDataReader Dr = Cm.ExecuteReader();

if (Dr.Read()) {

Session[\"username\"] = Name.Text; Session[\"password\"] = Pwd.Text; string a = Dr[6].ToString(); if(a==\"1\")

{

Response.Write(\"\"); } else

{

Response.Write(\"\"); }

Dr.Close();

} else

{

Response.Write(\"\");

}

con.Close(); }

protectedvoid Button1_Click(object sender, EventArgs e) {

Response.Redirect(\"gqx.aspx\"); }

protectedvoid Button3_Click(object sender, EventArgs e) {

Response.Redirect(\"chengfa.aspx\"); }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"xinshu.aspx\"); } } 2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls; using System.Data;

using System.Data.SqlClient;

using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT top 1 bname FROM book order by bn desc\", con); SqlDataAdapter Adapter = newSqlDataAdapter(); Adapter.SelectCommand = Cm; DataSet ds = newDataSet(); Adapter.Fill(ds); DataTable dt = ds.Tables[0];

Label6.Text = dt.Rows[0][0].ToString();

SqlCommand Cm1= newSqlCommand(\"SELECT * from punishiment\", con); SqlDataAdapter Adp = newSqlDataAdapter(); Adp.SelectCommand = Cm1; DataSet ds1 = newDataSet(); Adp.Fill(ds1); DataTable dt1= ds1.Tables[0];

GridView2.DataSource = dt1; GridView2.DataBind();

GridView2.HeaderRow.Cells[0].Text = \"书名\"; GridView2.HeaderRow.Cells[1].Text = \"书号\"; GridView2.HeaderRow.Cells[2].Text = \"超出时间\"; GridView2.HeaderRow.Cells[3].Text = \"惩罚金钱\"; GridView2.HeaderRow.Cells[4].Text = \"作者\";

con.Close(); }

protectedvoid Button1_Click(object sender, EventArgs e) {

Panel6.Visible = false; hy.Visible = true;

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

MD5CryptoServiceProvider md5Hasher = newMD5CryptoServiceProvider(); UTF8Encoding encoder = newUTF8Encoding();

String enpwd =

Convert.ToBaseString(md5Hasher.ComputeHash(encoder.GetBytes(this.TxtUserPwd.Text.Trim())));

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + TxtUserName.Text + \"' AND pwd ='\" + enpwd + \"'\", con); SqlDataReader Dr = Cm.ExecuteReader();

if (Dr.Read()) {

Session[\"username\"] = TxtUserName.Text; Session[\"password\"] = TxtUserPwd.Text;

Response.Write(\"\"); Dr.Close();

} else

{

Response.Write(\"\");

}

con.Close(); }

protectedvoid LinkButton5_Click(object sender, EventArgs e)

{

Response.Redirect(\"管理员管理.aspx\"); }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"register.aspx\"); }

protectedvoid Button3_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM book WHERE bname ='\" + TextBox1.Text + \"' or name ='\" + TextBox1.Text + \"'\", con);

Panel7.Visible = true; Panel6.Visible = false; Panel8.Visible = false; hy.Visible = false; SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Session[\"bnameorauthor\"] = TextBox1.Text; Dr.Close();

SqlDataAdapter Adapter = newSqlDataAdapter(); Adapter.SelectCommand = Cm; DataSet ds = newDataSet(); Adapter.Fill(ds); DataTable dt = ds.Tables[0];

GridView1.DataSource = dt; GridView1.DataBind();

GridView1.HeaderRow.Cells[0].Text = \"书号\"; GridView1.HeaderRow.Cells[1].Text = \"书名\"; GridView1.HeaderRow.Cells[2].Text = \"数量\"; GridView1.HeaderRow.Cells[3].Text = \"价格\"; GridView1.HeaderRow.Cells[4].Text = \"区域\"; GridView1.HeaderRow.Cells[5].Text = \"作者\"; GridView1.HeaderRow.Cells[6].Text = \"出版时间\";

} else

{

Response.Write(\"\");

}

con.Close(); }

protectedvoid LinkButton1_Click(object sender, EventArgs e) {

Panel7.Visible = false; Panel6.Visible = false; Panel8.Visible = true; hy.Visible = true; Label4.Visible = false; }

protectedvoid GridView2_SelectedIndexChanged(object sender, EventArgs e) { }

protectedvoid TextBox1_TextChanged(object sender, EventArgs e) { }

protectedvoid LinkButton4_Click(object sender, EventArgs e) {

Label4.Visible = true; Panel6.Visible = false; Panel7.Visible = false; hy.Visible = true; Panel8.Visible = false; }

protectedvoid LinkButton6_Click(object sender, EventArgs e)

{

Response.Redirect(\"jiehuanshu.aspx\"); } }

八、首页2 1、

<%@PageLanguage=\"C#\"AutoEventWireup=\"true\"CodeFile=\"首页.aspx.cs\"Inherits=\"_Default\"%>

.auto-style1 { width: 100%; height: 605px; } .auto-style2 { height: 120px; text-align: left;

background-color: #CCFF99; } .auto-style4 { width: 363px; height: 120px;

background-color: #CCFF99; } .auto-style9 { width: 363px; height: 24px;

background-color: #99FF33; } .auto-style11 { width: 18%; height: 24px;

background-color: #99FF33; } .auto-style13 { text-align: right; height: 33px; }

.auto-style14 { width: 363px; height: 47px; } .auto-style15 { width: 23%; height: 47px; } .auto-style16 { height: 47px; } .auto-style19 { height: 108px; } .auto-style20 { height: 24px;

background-color: #99FF33; } .auto-style21 {

background-color: #CCFF99; }

首页

借书规程

                             

 

借还书

管理员入口

用户:

密码:


  

      你好! 查询书籍或者作者

 

惩罚公告

\"Visible=\"False\">



版权所有:赵婷芳

2、

using System;

using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI;

using System.Web.UI.WebControls;

using System.Data;

using System.Data.SqlClient; using System.Security.Cryptography; using System.Text;

publicpartialclass_Default : System.Web.UI.Page {

protectedvoid Page_Load(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT top 1 bname FROM book order by bn desc\", con); SqlDataAdapter Adapter = newSqlDataAdapter(); Adapter.SelectCommand = Cm; DataSet ds = newDataSet(); Adapter.Fill(ds); DataTable dt = ds.Tables[0];

Label6.Text = dt.Rows[0][0].ToString();

SqlCommand Cm1 = newSqlCommand(\"SELECT * from punishiment\", con); SqlDataAdapter Adp = newSqlDataAdapter(); Adp.SelectCommand = Cm1; DataSet ds1 = newDataSet(); Adp.Fill(ds1); DataTable dt1 = ds1.Tables[0];

GridView2.DataSource = dt1; GridView2.DataBind();

GridView2.HeaderRow.Cells[0].Text = \"书名\"; GridView2.HeaderRow.Cells[1].Text = \"书号\"; GridView2.HeaderRow.Cells[2].Text = \"超出时间\"; GridView2.HeaderRow.Cells[3].Text = \"惩罚金钱\"; GridView2.HeaderRow.Cells[4].Text = \"作者\";

con.Close(); }

protectedvoid Button1_Click(object sender, EventArgs e) {

Panel6.Visible = false; hy.Visible = true;

if (TxtUserName.Text != null&& TxtUserPwd.Text != null) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

MD5CryptoServiceProvider md5Hasher = newMD5CryptoServiceProvider(); UTF8Encoding encoder = newUTF8Encoding();

String enpwd =

Convert.ToBaseString(md5Hasher.ComputeHash(encoder.GetBytes(this.TxtUserPwd.Text.Trim())));

SqlCommand Cm = newSqlCommand(\"SELECT * FROM [user] WHERE name='\" + TxtUserName.Text + \"' AND pwd ='\" + enpwd + \"'\", con); SqlDataReader Dr = Cm.ExecuteReader();

if (Dr.Read()) {

Session[\"username\"] = TxtUserName.Text; Session[\"password\"] = TxtUserPwd.Text;

Response.Write(\"\"); Dr.Close();

} else

{

Response.Write(\"\");

}

con.Close(); } else {

Response.Write(\"\"); }

}

protectedvoid LinkButton5_Click(object sender, EventArgs e) {

Response.Redirect(\"管理员管理.aspx\"); }

protectedvoid Button2_Click(object sender, EventArgs e) {

Response.Redirect(\"register.aspx\"); }

protectedvoid Button3_Click(object sender, EventArgs e) {

string connection = \"data

source=USER-20140927PZ\\\\SQLEXPRESS;uid=sa;pwd=123456;database=zhaotingfang\"; SqlConnection con = newSqlConnection(connection); con.Open();

SqlCommand Cm = newSqlCommand(\"SELECT * FROM book WHERE bname ='\" + TextBox1.Text + \"' or name ='\" + TextBox1.Text + \"'\", con);

Panel7.Visible = true; Panel6.Visible = false; Panel8.Visible = false; hy.Visible = false; SqlDataReader Dr = Cm.ExecuteReader(); if (Dr.Read()) {

Session[\"bnameorauthor\"] = TextBox1.Text; Dr.Close();

SqlDataAdapter Adapter = newSqlDataAdapter(); Adapter.SelectCommand = Cm; DataSet ds = newDataSet(); Adapter.Fill(ds); DataTable dt = ds.Tables[0];

GridView1.DataSource = dt; GridView1.DataBind();

GridView1.HeaderRow.Cells[0].Text = \"书号\"; GridView1.HeaderRow.Cells[1].Text = \"书名\"; GridView1.HeaderRow.Cells[2].Text = \"数量\"; GridView1.HeaderRow.Cells[3].Text = \"价格\";

GridView1.HeaderRow.Cells[4].Text = \"区域\"; GridView1.HeaderRow.Cells[5].Text = \"作者\"; GridView1.HeaderRow.Cells[6].Text = \"出版时间\";

} else

{

Response.Write(\"\");

}

con.Close(); }

protectedvoid LinkButton1_Click(object sender, EventArgs e) {

Panel7.Visible = false; Panel6.Visible = false; Panel8.Visible = true; hy.Visible = true; Label4.Visible = false; }

protectedvoid GridView2_SelectedIndexChanged(object sender, EventArgs e) { }

protectedvoid TextBox1_TextChanged(object sender, EventArgs e) { }

protectedvoid LinkButton4_Click(object sender, EventArgs e) {

Label4.Visible = true; Panel6.Visible = false; Panel7.Visible = false; hy.Visible = true; Panel8.Visible = false; }

protectedvoid LinkButton6_Click(object sender, EventArgs e) {

Response.Redirect(\"jiehuanshu.aspx\"); } }

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- stra.cn 版权所有 赣ICP备2024042791号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务