private void btnLogIn_Click(object sender, EventArgs e) { using (SqlConnection con = DBConnection.Connecting()) { con.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "CheckidExist"; cmd.Parameters.AddWithValue("id", txtId.Text); SqlDataReader sdr = cmd.ExecuteReader(); Users user = new Users(); while (sdr.Read()) { user.Id = sdr["id"].ToString(); user.Password = sdr["password"].ToString(); user.Name = sdr["name"].ToString(); idExist = true; } if (user.Id != null) { if (user.Password.Equals(txtPwd.Text)) { MessageBox.Show("로그인 성공"); this.Close(); FrmAnalysis fa = new FrmAnalysis(user); fa.Show(); } else { MessageBox.Show("비밀번호가 틀렸습니다"); } } else { MessageBox.Show("존재하지 않는 아이디 입니다."); } con.Close(); } }
private void btnAnalyst_Click(object sender, EventArgs e) { FrmAnalysis fa = new FrmAnalysis(); fa.ShowDialog(); }