diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/.keep" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..508cf92da94752e91b494eec410e8d2b6c0a07dc --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx" @@ -0,0 +1,16 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="WebApplication2.Login" %> + + + + + + + + + +
+
+
+
+ + diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx.cs" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..aadeafe0fc82fe8141afc6e6a6cd4ef6e473b8a2 --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx.cs" @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebApplication2 +{ + public partial class Login : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + //string username = Request.QueryString["name"]; + string username = Request.Form["TextBox1"]; + Response.Write(username+"欢迎你"); + } + } +} \ No newline at end of file diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx" new file mode 100644 index 0000000000000000000000000000000000000000..3819b891344131abef6a087e542d59788eef592d --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx" @@ -0,0 +1,29 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %> + + + + + + + + + +
+
+ + + + + + + +
用户名: +
密码: +
+ + +
+
+
+ + diff --git "a/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx.cs" "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx.cs" new file mode 100644 index 0000000000000000000000000000000000000000..784de129239571515938fbadc23f308da9eb3b39 --- /dev/null +++ "b/\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx.cs" @@ -0,0 +1,49 @@ +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 WebApplication2 +{ + public partial class WebForm1 : System.Web.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; + + //Response.Redirect($"Login.aspx?name={name}"); + string constr = "server=.;uid=gao;pwd=123;database=Student_db"; //数据库连接串的编写 + SqlConnection sqlcon = new SqlConnection(constr); //SqlConnection 类与数据库连接 + sqlcon.Open(); + string sql = "select * from StudentInfo where stu_name=@name and password=@pwd"; //查询的内容 @为标记的内容 + SqlParameter[] pars = + { + new SqlParameter("@name",name), + new SqlParameter("@pwd",pwd) + }; + + SqlCommand cmd = new SqlCommand(sql, sqlcon); + cmd.Parameters.AddRange(pars); + SqlDataReader sdr = cmd.ExecuteReader(); //查询 + if (sdr.Read()) + { + Literal1.Text = "登录成功去看看吧"; + + } + else + { + Literal1.Text = "登录失败"; + } + + } + } +} \ No newline at end of file