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

📄 mod.cs

📁 这是一个考勤系统大家多多指教
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace kaoqin
{
    public partial class Mod : Form
    {
        public Mod()
        {
            InitializeComponent();
        }

        private void Mod_Load(object sender, EventArgs e)
        {
            string sql = "select * from [user] where name='" + DB.userName + "'";
            DataTable dt = DB.getTable(sql);
            this.textBox4.Text = dt.Rows[0]["realName"].ToString().Trim();
        }

        private void mod()
        {
            string name = DB.userName;
            string sql = "update [user] set pwd='"+this.textBox2.Text.Trim()+"',realName='"+this.textBox4.Text.Trim()+"' where name='"+name+"'";
            if (DB.executeSql(sql))
            {
                MessageBox.Show("操作成功!");
            }
            else
            {
                MessageBox.Show("操作失败!");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox1.Text.Trim() == "")
            {
                MessageBox.Show("请输入原密码!");
                this.textBox1.Focus();
                return;
            }
            if (this.textBox2.Text.Trim() == "")
            {
                MessageBox.Show("请输入新密码!");
                this.textBox2.Focus();
                return;
            }
            if (this.textBox3.Text.Trim() == "")
            {
                MessageBox.Show("请输入确认密码!");
                this.textBox3.Focus();
                return;
            }
            if (this.textBox2.Text.Trim() != this.textBox3.Text.Trim())
            {
                MessageBox.Show("密码不一致!");
                this.textBox2.Focus();
                return;
            }
            if (this.textBox4.Text.Trim() == "")
            {
                MessageBox.Show("请输入用户姓名!");
                this.textBox4.Focus();
                return;
            }
            string sql = "select * from [user] where name='"+DB.userName+"'";
            DataTable dt = DB.getTable(sql);
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("原密码不正确!");
                this.textBox1.Focus();
                return;
            }
            mod();
        }
    }
}

⌨️ 快捷键说明

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