From 73a09369710f546fdadf0095caeea40227a57622 Mon Sep 17 00:00:00 2001 From: luo-langzi <3366839375@qq.com> Date: Thu, 24 Jun 2021 22:30:16 +0800 Subject: [PATCH] first commit --- .../.keep" | 0 .../Login.aspx" | 16 ++++++ .../Login.aspx.cs" | 19 +++++++ .../WebForm1.aspx" | 29 +++++++++++ .../WebForm1.aspx.cs" | 49 +++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/.keep" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/Login.aspx.cs" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx" create mode 100644 "\347\254\2546\346\254\241\344\275\234\344\270\232/\347\275\227\346\265\252\345\255\220/WebForm1.aspx.cs" 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 0000000..e69de29 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 0000000..508cf92 --- /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 0000000..aadeafe --- /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 0000000..3819b89 --- /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 0000000..784de12 --- /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 -- Gitee