嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元微信扫码支付:2 元
请留下您的邮箱,我们将在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 = "";
}
}
}
}
}