private void searchBtn_Click(object sender, EventArgs e) { MySqlConnection connection = DBConnection.getDbConnection().getConnection(); MySqlCommand mcd; MySqlDataReader mdr; try { connection.Open(); string s = "select * from MEMBER where athleticId='" + searchText.Text + "'"; mcd = new MySqlCommand(s, connection); mdr = mcd.ExecuteReader(); if (mdr.Read()) { Member member = new Member(mdr.GetString("athleticId"), mdr.GetString("fullName"), mdr.GetString("nameWithInitials"), mdr.GetString("dob"), mdr.GetString("NICNo"), mdr.GetString("address"), mdr.GetInt32("telNo"), mdr.GetInt32("mobileNo"), mdr.GetString("occupation"), mdr.GetString("email"), mdr.GetString("DANorGUP"), mdr.GetString("kukkiwonNo"), mdr.GetString("belt"), mdr.GetString("club"), mdr.GetString("coacher")); //MessageBox.Show(mdr.GetString("nameWithInitials")); MemberViewAndUpdate memberViweAndUpdateForm = new MemberViewAndUpdate(member); memberViweAndUpdateForm.Show(); } else { MessageBox.Show("NO DATA"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { // mdr.Close(); connection.Close(); } }
private void memberSearchBtn_Click(object sender, EventArgs e) { Member member = MemberController.SearchMemberByAthleticId(searchMemberText.Text); if (searchMemberText.Text != "") { if (member != null) { MemberViewAndUpdate addAdminForm = new MemberViewAndUpdate(member, true); addAdminForm.Show(); return; } MessageBox.Show(searchMemberText.Text + " is not a member of Nationl Taekwondo Federation!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("Enter ahtletic id to search.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
private void memberSearchBtn_Click(object sender, EventArgs e) { Member member = MemberController.SearchMemberByAthleticId(searchMemberText.Text); try { if (member != null) { MemberViewAndUpdate memberViewAndUpdate = new MemberViewAndUpdate(member); memberViewAndUpdate.Show(); } else { MessageBox.Show("Member not found!", "Message", MessageBoxButtons.OK); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }