⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 修改密码.aspx.cs

📁 本系统时物资管理系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class 修改密码 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
   
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        this.Response.Redirect("登录.aspx");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String myConnStr = "data source=.;database=物资管理系统;trusted_connection=SSPI";

        SqlConnection myConn = new SqlConnection(myConnStr);

        String sql;
        if (this.TextBox4.Text != "")
        {
            String myConnStr1 = "data source=.;database=物资管理系统;trusted_connection=SSPI";

            SqlConnection myConn1 = new SqlConnection(myConnStr1);
             string mysql1 = "select  * from 用户表 where 用户名='" + TextBox4.Text + "'and 密码='" + TextBox5.Text + "'";
             myConn1.Open();
             SqlCommand cm1 = new SqlCommand(mysql1, myConn1);
             SqlDataReader dr1 = cm1.ExecuteReader();
             if (dr1.Read())
             {
                 sql = "update 用户表 set 密码='" + this.TextBox6.Text + "'";
                 if (this.TextBox6.Text == this.TextBox7.Text)
                 {
                     sql += "where 用户名='" + this.TextBox4.Text + "'";
                     SqlCommand myComm = new SqlCommand(sql, myConn);
                     myConn.Open();
                     myComm.ExecuteNonQuery();
                     myConn.Close();
                     Response.Write("<script>alert('修改成功!')</script>");
                 }
             }
           
             else
             {
                 Response.Write("<script>alert('用户信息输入错误!')</script>");
             }
             myConn1.Close();
                 //SqlCommand myComm = new SqlCommand(sql, myConn);
             //myConn.Open();
             //myComm.ExecuteNonQuery();
             //myConn.Close();
             //Response.Write("<script>alert('修改成功!')</script>");
        }
        else
            Response.Write("<script>alert('请您输入用户名')</script>");
    }
    protected void LinkButton1_Click1(object sender, EventArgs e)
    {
        this.Response.Redirect("登录.aspx");
    }
    protected void LinkButton1_Click2(object sender, EventArgs e)
    {
        this.Response.Redirect("登录.aspx");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -