C#登陆代码_c
C#登陆代码由刀豆文库小编整理,希望给你工作、学习、生活带来方便,猜你可能喜欢“c”。
private void button1_Click(object sender, EventArgs e)
{
string uname = this.textBox1.Text.ToString();
string upaword = this.textBox2.Text.ToString();
SqlConnection thisconnection = new SqlConnection(@“Server=AL;Integrated
Security=True;” + “DataBase=登陆界面”);
thisconnection.Open();
SqlCommand thiscommand = thisconnection.CreateCommand();
thiscommand.CommandText = “select uname,upaword from yh where uname='” + uname + “ '”;SqlDataReader thisreader = thiscommand.ExecuteReader();
if(thisreader.Read())
{
if(thisreader[“upaword”].ToString().Trim()== upaword)
{
MeageBox.Show(“恭喜您登陆成功!”, “登陆成功!”, MeageBoxButtons.OK, MeageBoxIcon.Information);
yhxx tt = new yhxx();
tt.Show();
}
else { MeageBox.Show(“密码错误,请重新输入!”, “错误”, MeageBoxButtons.OK, MeageBoxIcon.Information);}
}
else { MeageBox.Show(“此用户不存在,请您注册!”, “注册”, MeageBoxButtons.OK, MeageBoxIcon.Information);}
thisconnection.Close();
thisreader.Close();
}
private void button2_Click(object sender, EventArgs e)
{
zhuce = new zhuce();
.Show();
}