diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/SqlHelper.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/SqlHelper.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..e85bff4090d4533454649939c3eff49aa3733ee2
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/SqlHelper.cs"
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq;
+using System.Web;
+
+namespace WebApplication4
+{
+ public class SqlHelper
+ {
+ private static string constr = "Server=.;Database=Student_db;Trusted_Connection=Yes;Connect Timeout = 90";
+ private SqlConnection con = null;
+
+ public SqlHelper()
+ {
+ con = new SqlConnection(constr);
+ }
+ public DataTable Get(string sql,SqlParameter[] pars)
+ {
+ try
+ {
+ if (con.State == ConnectionState.Closed)
+ {
+ con.Open();
+ }
+ SqlCommand cmd = new SqlCommand(sql, con);
+ if (pars != null)
+ {
+ cmd.Parameters.AddRange(pars);
+ }
+ SqlDataAdapter sda = new SqlDataAdapter(cmd);
+ DataSet ds = new DataSet();
+ sda.Fill(ds);
+ return ds.Tables[0];
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message.ToString());
+ }
+ finally
+ {
+ if (con != null)
+ {
+ con.Close();
+ }
+ }
+ }
+ public bool Execute(string sql, SqlParameter[] pars)
+ {
+ try
+ {
+ if (con.State == ConnectionState.Closed)
+ {
+ con.Open();
+ }
+ SqlCommand cmd = new SqlCommand(sql, con);
+ if (pars != null)
+ {
+ cmd.Parameters.AddRange(pars);
+ }
+ int result = cmd.ExecuteNonQuery();
+ return result > 0 ? true : false;
+ }
+ catch (Exception e)
+ {
+ throw new Exception(e.Message.ToString());
+ }
+ finally
+ {
+ if (con != null)
+ {
+ con.Close();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx"
new file mode 100644
index 0000000000000000000000000000000000000000..4eb8c676591ea0d21b4b5a3166bdb9b18704ff7c
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx"
@@ -0,0 +1,38 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication4.WebForm1" %>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..3831407bfdfb8fd0347d505d63625cfaa2bd9591
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.cs"
@@ -0,0 +1,106 @@
+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 WebApplication4
+{
+ public partial class WebForm1 : System.Web.UI.Page
+ {
+ static SqlHelper helper = new SqlHelper();
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ if (!IsPostBack)
+ {
+ BindGV();
+ }
+ }
+ public void BindGV()
+ {
+ GridView1.DataSource = helper.Get("select * from StudentInfo",null);
+ GridView1.DataKeyNames = new string[] {"stu_id"};
+ GridView1.DataBind();
+ }
+ protected void Button1_Click(object sender, EventArgs e)
+ {
+ string str = TextBox1.Text;
+ string sql = "select * from StudentInfo where stu_name like '%'+@name+'%'";
+ SqlParameter[] pars =
+ {
+ new SqlParameter("@name",str)
+ };
+
+ GridView1.DataSource = helper.Get(sql,pars);
+ GridView1.DataBind();
+ }
+
+ protected void Button2_Click(object sender, EventArgs e)
+ {
+ Response.Redirect("WebForm2.aspx");
+ }
+
+ protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
+ {
+ GridView1.EditIndex = e.NewEditIndex;
+ BindGV();
+ }
+
+ protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
+ {
+ GridView1.EditIndex = -1;
+ BindGV();
+ }
+
+ protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
+ {
+ string id = GridView1.DataKeys[e.RowIndex].Value.ToString();
+
+ string name = (GridView1.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox).Text;
+ string pwd = (GridView1.Rows[e.RowIndex].Cells[4].Controls[0] as TextBox).Text;
+ string email = (GridView1.Rows[e.RowIndex].Cells[2].Controls[0] as TextBox).Text;
+ string intro = (GridView1.Rows[e.RowIndex].Cells[3].Controls[0] as TextBox).Text;
+
+ string sql = "update StudentInfo set stu_name=@name,password=@pwd,email=@email,intro=@intro where stu_id=@id";
+ SqlParameter[] pars =
+ {
+ new SqlParameter("@id",id),
+ new SqlParameter("@name",name),
+ new SqlParameter("@pwd",pwd),
+ new SqlParameter("@email",email),
+ new SqlParameter("@intro",intro)
+
+ };
+
+ if (helper.Execute(sql, pars))
+ {
+ GridView1.EditIndex = -1;
+ BindGV();
+ }
+ else
+ {
+ Response.Write("");
+ }
+ }
+
+ 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[] pars =
+ {
+ new SqlParameter("id",id)
+ };
+ if (helper.Execute(sql,pars))
+ {
+ BindGV();
+ }
+ else
+ {
+ Response.Write("");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.designer.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..e85110182606087df333ab31f3d57aa2dfce940e
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm1.aspx.designer.cs"
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace WebApplication4
+{
+
+
+ public partial class WebForm1
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// TextBox1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.TextBox TextBox1;
+
+ ///
+ /// Button1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Button Button1;
+
+ ///
+ /// Button2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Button Button2;
+
+ ///
+ /// GridView1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.GridView GridView1;
+
+ ///
+ /// SqlDataSource1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.SqlDataSource SqlDataSource1;
+ }
+}
diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx"
new file mode 100644
index 0000000000000000000000000000000000000000..feca8d656d0d4a702e51d78e4404fadb87f42156
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx"
@@ -0,0 +1,48 @@
+<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication4.WebForm2" %>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git "a/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..83348beca7403693e1530fafb78d33a0c836a22c
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.cs"
@@ -0,0 +1,44 @@
+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 WebApplication4
+{
+ public partial class WebForm2 : System.Web.UI.Page
+ {
+ static SqlHelper helper = new SqlHelper();
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ protected void Button2_Click(object sender, EventArgs e)
+ {
+ string name = UserName.Text;
+ string pwd = Password.Text;
+ string email = Email.Text;
+ string intro = Intro.Text;
+
+ string sql = "insert into StudentInfo (stu_name,password,email,intro)values(@name,@pwd,@email,@intro)";
+ SqlParameter[] pars =
+ {
+ new SqlParameter("@name",name),
+ new SqlParameter("@pwd",pwd),
+ new SqlParameter("@email",email),
+ new SqlParameter("@intro",intro)
+ };
+ if (helper.Execute(sql, pars))
+ {
+ 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/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.designer.cs" "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.designer.cs"
new file mode 100644
index 0000000000000000000000000000000000000000..e310a25fb3d0415173e3e1006c56b4faf524fc85
--- /dev/null
+++ "b/\347\254\2547\346\254\241\344\275\234\344\270\232/\347\275\227\351\233\250\346\254\243/WebForm2.aspx.designer.cs"
@@ -0,0 +1,80 @@
+//------------------------------------------------------------------------------
+// <自动生成>
+// 此代码由工具生成。
+//
+// 对此文件的更改可能导致不正确的行为,如果
+// 重新生成代码,则所做更改将丢失。
+// 自动生成>
+//------------------------------------------------------------------------------
+
+namespace WebApplication4
+{
+
+
+ public partial class WebForm2
+ {
+
+ ///
+ /// form1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ ///
+ /// UserName 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.TextBox UserName;
+
+ ///
+ /// Password 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Password;
+
+ ///
+ /// Email 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Email;
+
+ ///
+ /// Intro 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Intro;
+
+ ///
+ /// Button2 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Button Button2;
+
+ ///
+ /// Label1 控件。
+ ///
+ ///
+ /// 自动生成的字段。
+ /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
+ ///
+ protected global::System.Web.UI.WebControls.Label Label1;
+ }
+}