private void userResult_btn_Click(object sender, EventArgs e) { // IF,, not typing id if (id_txt.Text.Length > 1) { AngleInfo_user user = new AngleInfo_user(id_txt.Text); user.Show(); } else { MessageBox.Show("아이디를 입력해야 합니다!"); } }
private void login_btn_Click(object sender, EventArgs e) { if (member_radio.Checked) { // id, pw Validation check bool chk = false; Database_set(); try { using (conn = new MySqlConnection(DB_INFO)) { if (conn.State == ConnectionState.Closed) { conn.Open(); } string sql = "SELECT * FROM INFO"; // All data of INFO table. MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { // ID and P/W of INFO table check if (rdr["ID"].Equals(id_txt.Text) && rdr["PW"].Equals(pw_txt.Text)) { chk = true; // Success is next layout. break; } } rdr.Close(); } } catch (Exception ex) { Console.WriteLine("SELECT * FROM INFO error!"); MessageBox.Show(ex.Message); MessageBox.Show(ex.StackTrace); } if (chk) { this.Hide(); AngleInfo_user user = new AngleInfo_user(id_txt.Text, pw_txt.Text); user.Show(); } else { MessageBox.Show("아이디 또는 비밀번호를 확인해주세요!"); } } else if (admin_radio.Checked) { if (id_txt.Text.Equals("admin") && pw_txt.Text.Equals("gstc4900")) { this.Hide(); Admin admin = new Admin(); admin.Show(); } else { MessageBox.Show("아이디 또는 비밀번호를 확인하세요."); } } }