private void menuItem5_Click(object sender, EventArgs e) { if (Utils.isFilledUp(controls)) { if (!DatabaseHandler.getInstance().modifyTable(String.Format(Queries.insert_patient_info, txtfname.Text, txtmi.Text, txtlname.Text, txtadd.Text, txtoccupation.Text, txtcontact.Text, txtage.Text, cmbstatus.Text, cmbGender.Text, txtcomplain.Text))) { MessageBox.Show("wasnt able to insert rolling back......"); return; } int id = DatabaseHandler.getInstance().getIntData(Queries.select_patient_info_id_latest); for (int a = 0; a < diseaseList.Items.Count; a++) { if (!DatabaseHandler.getInstance().modifyTable(String.Format(Queries.insert_history_info, id, diseaseList.Items[a]))) { MessageBox.Show("wasnt able to insert rolling back......"); break; } } for (int a = 0; a < questions.Length; a++) { if (!DatabaseHandler.getInstance().modifyTable(String.Format(Queries.insert_question_info, id, questions[a].Question_, questions[a].Answer))) { MessageBox.Show("wasnt able to insert rolling back......"); break; } } registerTeeths(id, 11, 18, true); registerTeeths(id, 21, 28, true); registerTeeths(id, 31, 38, true); registerTeeths(id, 41, 48, true); registerTeeths(id, 51, 56, false); registerTeeths(id, 61, 66, false); registerTeeths(id, 81, 86, false); registerTeeths(id, 71, 76, false); patientInfoList.fill(DatabaseHandler.getInstance().getTable(Queries.select_patient_info)); } else { MessageBox.Show("Please fill up all the textboxes!"); } }