private void btnUp_Click(object sender, EventArgs e) { frmOperate fl = new frmOperate(); fl.Show(); this.Close(); }
/// <summary> /// 1.点击确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, EventArgs e) { #region //使用类封装 string sql = "select * from UserInfo Where UserName='******'and UserPwd='" + txtPassWord.Text.Trim() + "' "; if (OprateDB.ExecuteReader(sql)) { //写上用户名 username = txtUserName.Text.Trim().ToLower(); frmOperate frm = new frmOperate(); frm.Show(); this.Hide(); } else { i++; if (i == 1) { MessageBox.Show("用户名或密码错误,您还有二次机会"); MessageBox.Show("用户名或密码错误", "出错了", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (i == 2) { MessageBox.Show("用户名或密码错误,您还有一次机会"); MessageBox.Show("用户名或密码错误", "出错了", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (i == 3) { MessageBox.Show("用户名或密码错误,您还有0次机会"); MessageBox.Show("卡已被锁定", "请30分钟再试!", MessageBoxButtons.OK, MessageBoxIcon.Error); i = 0; } } #endregion }