登录模块/ForgetPwd2.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using PropertyManagementSystem;

namespace PropertyManagementSystem
{
    public partial class ForgetPwd2 : Form
    {
        public ForgetPwd2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //获取文本框中所输入的值
            string passWord = this.textBox1.Text;
            string rightPwd = this.textBox2.Text;
            if (passWord.Length < 6 || passWord.Length > 12)
              {
                  MessageBox.Show("密码长度不符合要求!", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
              }//判断用户的密码和确认密码是否填写一致
              else if (passWord != rightPwd)
              {
                  MessageBox.Show("密码和确认密码不一致!!", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
              }
            else
            {
                  //从数据库查询身份证号码
                  string sqls="select idCard from Users";
                 SqlDataReader reader= DBHelper.GetDataReader(sqls);
                 string sfz = "";
                  //读取
                 while (reader.Read())
                 {
                      sfz = reader["idCard"].ToString();
                 }
                  //编写修改sql
                 string sql = string.Format("update Users set userPwd='{0}' where idCard='{1}'", passWord, sfz);
                  //关闭读取
                 reader.Close();
               bool result  = DBHelper.GetExecuteNonQuery(sql);
               if (result ==true)
               {
                   MessageBox.Show("修改成功");
                   //关闭数据库
                   DBHelper.CloseConnection();
                   //跳转登陆页面
                   LoginFrom login = new LoginFrom();
                   this.Hide();
                   this.Close();
                   login.Show();
后面还有 48 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。