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

📄 form3.cs

📁 c# + sql2000 学生管理系统
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace StudentManage.UILevel
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            if (comboBox1.Text.Trim() == "" || textBox2.Text.Trim() == "" || textBox3.Text.Trim() == "" || textBox4.Text.Trim() == "")
            {
                MessageBox.Show("请填写完整信息!", "错误提示");
            }
            else
            {
                SqlConnection nn = new SqlConnection();
                nn.ConnectionString = "server=localhost;uid=sa;pwd=;database=raiks";
                nn.Open();
                string mm = "select * from raiks where uid='" + this.comboBox1.Text + "'and pwd='" + this.textBox2.Text + "'";
                SqlCommand ss = new SqlCommand(mm, nn);
                ss.CommandText = mm;
                if (ss.ExecuteScalar() == null)
                {
                    MessageBox.Show("用户名或密码错误!", "错误提示");
                }
                else
                {
                    if (textBox3.Text.Trim() != textBox4.Text.Trim())
                    {
                        MessageBox.Show("新密码和确认密码不一致,请重新输入!", "错误提示");
                    }
                    else
                    {

                        string ww = "update raiks set pwd='" + this.textBox3.Text + "' where uid='" + this.comboBox1.Text + "'";
                        ss.CommandText = ww;
                        ss.ExecuteNonQuery();
                        this.Close();
                        nn.Close();

                        MessageBox.Show("密码修改成功!", "成功提示");
                    }
                }


            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
        }
    }
}

⌨️ 快捷键说明

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