private void getValues() { int gender = 0, type = 0; string code = "", first = "", middle = "", last = "", birthday = "", height = "", weight = "", contact = "", college = "", course = "", year = "", section = ""; code = grid.CurrentRow.Cells[0].Value.ToString(); try { if (LoginNew.conn != null && (LoginNew.conn.State == ConnectionState.Closed)) { LoginNew.conn.Open(); } using (MySqlCommand cmd = new MySqlCommand("SELECT strPatiCode,intPatiType,strPatiLastName,strPatiFirstName,strPatiMiddleName,datPatiDOB,intPatiGender,fltPatiHeight,fltPatiWeight,strPatiContact,strStuICourCode,strStuIYear,strStuISection,strCourCollCode from dbmedicalclinic.tblpatient left join dbmedicalclinic.tblstudentinfo ON strpaticode = strstuiPatiCode left join dbmedicalclinic.tblcourse ON strStuICourCode=strCourCode where strpaticode = '" + code + "';", LoginNew.conn)) { using (MySqlDataReader dataReader = cmd.ExecuteReader()) { //Read the data and store them in the list if (dataReader.Read()) { code = dataReader.GetString(0); type = dataReader.GetInt32(1); last = dataReader.GetString(2); first = dataReader.GetString(3); middle = dataReader.GetString(4); birthday = dataReader.GetString(5); gender = dataReader.GetInt32(6); height = dataReader.GetString(7); weight = dataReader.GetString(8); contact = dataReader.GetString(9); course = dataReader.GetString(10); year = dataReader.GetString(11); section = dataReader.GetString(12); college = dataReader.GetString(13); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { LoginNew.conn.Close(); } form = new FormAddPatient(code, type, first, middle, last, birthday, gender, height, weight, contact, college, course, year, section); form.FormClosed += Form_FormClosed; }
private void btnAdd_Click(object sender, EventArgs e) { formpatient = new FormAddPatient(this); formpatient.ShowDialog(); }