private void btnEnterRecord_Click(object sender, EventArgs e) { Admission_Form newForm = new Admission_Form("", true); newForm.Owner = this; newForm.Show(); this.Hide(); }
private void btnEnter_Click(object sender, EventArgs e) { con.Open(); string formNo = getFormNoBox.Text.ToString().ToUpper(); string formNo1 = "", formNo2 = ""; if (formNo.Length > 2) { formNo1 = formNo.Substring(0, 2); } if (formNo.Length > 1) { formNo2 = formNo.Substring(0, 1); } DataTable dt = new DataTable(); bool found = true; bool isUG = true; if (formNo1 == "UG" && formNo.Length > 2) { SqlDataAdapter da = new SqlDataAdapter("SELECT UG_FORM_NO FROM UG_CANDIDATE WHERE UG_FORM_NO = '" + getFormNoBox.Text.ToUpper() + "'", con); da.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("No Record Found !", "Oops"); found = false; } else { isUG = true; } } else if (formNo2 == "G" && formNo.Length > 1) { SqlDataAdapter da = new SqlDataAdapter("SELECT G_FORM_NO FROM G_CANDIDATE WHERE G_FORM_NO = '" + getFormNoBox.Text.ToUpper() + "'", con); da.Fill(dt); if (dt.Rows.Count == 0) { MessageBox.Show("No Record Found !", "Oops"); found = false; } else { isUG = false; } } else { MessageBox.Show("No Record Found !", "Oops"); found = false; } if (found && dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == getFormNoBox.Text.ToUpper()) { Admission_Form newForm = new Admission_Form(getFormNoBox.Text.ToUpper(), isUG); newForm.Owner = this; newForm.Show(); this.Hide(); } con.Close(); }