diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..73092b9391d42efcb492be6d4f39a57794d0a62e --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx" @@ -0,0 +1,22 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> + + + + + + + + + +
+
+ 账号:

+ 密码:

+       +
+ + +
+
+ + diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..f71cb329ba9d0801b898b446a747c29ff728caf6 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.cs" @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + + public partial class WebForm1 : System.Web.UI.Page + { + help h = new help(); + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button2_Click(object sender, EventArgs e) + { + Response.Redirect("WebForm2.aspx"); + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = TextBox1.Text; + string pwd = TextBox2.Text; + + string sql = "select* from StudentInfo where stu_name = @name and password = @pwd"; + SqlParameter[] pras = { + new SqlParameter("@name",name), + new SqlParameter("@pwd",pwd) + }; + DataTable dt = h.Get(sql, pras); + if (dt.Rows.Count > 0) + { + Session["yhm"] = name; + Response.Redirect("WebForm3.aspx"); + } + else { + Label1.Text = "密码或用户名错误!!!"; + } + + } + } +} \ No newline at end of file diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..f3b1d6a48c033bba302620bfe3c34e8c68058ebf --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm1.aspx.designer.cs" @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class WebForm1 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// TextBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// + /// TextBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + } +} diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..c90dec0b01c426e7316e289acb13404a2331f2c3 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx" @@ -0,0 +1,20 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication1.WebForm2" %> + + + + + + + + + +
+
+ 账号:

+ 密码:

+
    + +
+
+ + diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..c4fbe9a2b81af9d8546084362071116c402d9d63 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.cs" @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm2 : System.Web.UI.Page + { + help h = new help(); + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = TextBox1.Text; + string pwd = TextBox2.Text; + string sql = "insert into StudentInfo(stu_name,password)values(@name,@pwd)"; + SqlParameter[] pras = { + new SqlParameter("@name",name), + new SqlParameter("@pwd",pwd) + }; + if (h.Execute(sql, pras)) + { + Label1.Text = "注册成功!!!去登陆"; + } + else { + Label1.Text = "注册失败!!!"; + } + } + } +} \ No newline at end of file diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..7b237f7a06584d2da972e7612c1833698c25c649 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm2.aspx.designer.cs" @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class WebForm2 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// TextBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// + /// TextBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Label1; + } +} diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..e7b11bad9141a5e17f56effcfc609745296070ec --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx" @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication1.WebForm3" %> + + + + + + + + + +
+
+
+
+ + diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..9e3604fd419266ff8242808e33cf20ce64082a10 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.cs" @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm3 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + if (Session["yhm"] == null) + { + Response.Redirect("WebForm1.aspx"); + } + else { + Response.Write($"欢迎{Session["yhm"]}来到我的网页"); + } + } + } +} \ No newline at end of file diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..c7b20975af550ece04cd45fbf4a281e6f44a2c12 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm3.aspx.designer.cs" @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class WebForm3 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + } +} diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..e99373152633d360f3e8dbe29d4eff75ae1f5eca --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx" @@ -0,0 +1,37 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="WebApplication1.WebForm4" %> + + + + + + + + + +
+
+ 姓名:
+ email:
+ 自我介绍:
+ 密码:
+

+
+
+ 姓名:    +

+
+
+ + + + + + + + + + +
+
+ + diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..eb109768c8decdba211de1c5ab76a9a098c88442 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.cs" @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlClient; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication1 +{ + public partial class WebForm4 : System.Web.UI.Page + { + help h = new help(); + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + ff(); + } + } + + private void ff() + { + GridView1.DataSource = h.Get("select * from StudentInfo", null); + GridView1.DataKeyNames = new string[] { "stu_id" }; + GridView1.DataBind(); + } + + protected void Button1_Click(object sender, EventArgs e) + { + string name = TextBox1.Text; + string sql = "select * from StudentInfo where stu_name like '%'+@name+'%'"; + SqlParameter[] pras = { + new SqlParameter("@name",name) + }; + GridView1.DataSource = h.Get(sql, pras); + GridView1.DataBind(); + } + + protected void Button2_Click(object sender, EventArgs e) + { + string name = TextBox2.Text; + string email = TextBox3.Text; + string intro = TextBox4.Text; + string pwd = TextBox5.Text; + string sql = "insert into StudentInfo(stu_name,email,intro,password)values(@name,@email,@intro,@pwd)"; + SqlParameter[] pras = { + new SqlParameter("@name",name), + new SqlParameter("@email",email), + new SqlParameter("@intro",intro), + new SqlParameter("@pwd",pwd) + }; + if (h.Execute(sql, pras)) + { + ff(); + } + else { + + } + } + + protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) + { + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + string sql = "delete from StudentInfo where stu_id = @id"; + SqlParameter[] pras = { + new SqlParameter("@id",id) + }; + if (h.Execute(sql,pras)) + { + ff(); + } + } + + protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) + { + GridView1.EditIndex = e.NewEditIndex; + ff(); + } + + protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) + { + GridView1.EditIndex = -1; + ff(); + } + + protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) + { + string name = (GridView1.Rows[e.RowIndex].Cells[0].Controls[0] as TextBox).Text; + string email = (GridView1.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox).Text; + string intro = (GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox).Text; + string pwd = (GridView1.Rows[e.RowIndex].Cells[3].Controls[0]as TextBox).Text; + string id = GridView1.DataKeys[e.RowIndex].Value.ToString(); + + string sql = "update StudentInfo set stu_name =@name,email=@email,intro=@intro,password=@pwd where stu_id =@id"; + SqlParameter[] pras ={ + new SqlParameter("@name",name), + new SqlParameter("@email",email), + new SqlParameter("@intro",intro), + new SqlParameter("@pwd",pwd), + new SqlParameter("@id",id), + }; + if (h.Execute(sql, pras)) + { + GridView1.EditIndex = -1; + ff(); + } + } + } +} \ No newline at end of file diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.designer.cs" new file mode 100644 index 0000000000000000000000000000000000000000..828434f95b2a66e68c27fd58d30524a5be1690b2 --- /dev/null +++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\346\261\237\346\264\213/WebForm4.aspx.designer.cs" @@ -0,0 +1,98 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace WebApplication1 +{ + + + public partial class WebForm4 + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// TextBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox2; + + /// + /// TextBox3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox3; + + /// + /// TextBox4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox4; + + /// + /// TextBox5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox5; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button2; + + /// + /// TextBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox TextBox1; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Button Button1; + + /// + /// GridView1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.GridView GridView1; + } +}