基本信息
源码名称:c# 员工管理系统源码
源码大小:3.06M
文件格式:.zip
开发语言:C#
更新时间:2021-06-23
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

人事管理系统

private void button1_Click(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection(connstr))
            {
                string sql = "select Password,UserType,ID from StaffAccount where Name='" textBox1.Text "'";
                using (SqlCommand cmd = new SqlCommand(sql, conn))
                {
                    conn.Open();//打开连接
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            string pwd = reader.GetString(0).Trim();
                            string utype = reader.GetString(1);
                            int id = reader.GetInt32(2);
                            if (pwd == textBox2.Text)
                            {
                                UserName = textBox1.Text;
                                UserType = utype;
                                ID = id;
                                MessageBox.Show("系统登录成功,正在跳转主页面...");
                                MainForm mainForm = new MainForm();
                                mainForm.Show();
                                this.Hide();
                            }
                            else {
                                MessageBox.Show("密码错误!请再次输入!");
                                textBox2.Text = "";
                            }
                        }
                        else
                        {
                            MessageBox.Show("用户名不存在,请重新出入!");
                            textBox1.Text = "";
                        }
                    }
                }
            }
        }