setall.cs

(开头部分) 2KB

这里只显示每个文件的开头 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;


namespace LoginFrame
{
    public partial class setall : Form
    {
        public setall()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnregedit_Click(object sender, EventArgs e)
        {
            if (loginpwd.Text == loginpwd1.Text)
            {
                try
                {
                    string sql = "";
                    // 判断 选择框内的内容来更新对应表内的密码
                    if (cbxUserStyle.Text == "教员")
                    {
                        sql = string.Format("UPDATE Teacherinfo set loginpwd='{0}' where loginid='{1}';", loginpwd.Text, username.Text);
                    }
                    else if (cbxUserStyle.Text == "管理员")
                    {
                        sql = string.Format("UPDATE Admin set loginpwd='{0}' where loginid='{1}';", loginpwd.Text, username.Text);
                    }
                    else
                    {
                        sql = string.Format("UPDATE stuinfo set loginpwd='{0}' where loginid='{1}';", loginpwd.Text, username.Text);
                    }


                    SqlCommand command = new SqlCommand(sql, DbHelper.connection);
                    DbHelper.connection.Open();
                    int i= command.ExecuteNonQuery();
                    if (i == 1)
                    {
                        MessageBox.Show("更改成功!");
                        // 返回管理员界面
                        AdminForm adminForm = new AdminForm();
                        adminForm.Show();
                        this.Hide();
                    }
                    else
后面还有 31 行代码,解锁后查看完整代码

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

AI 解读

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

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