private void button13_Click_1(object sender, EventArgs e) { doctorSQL checkforPRID = new doctorSQL(); if (button13.Text == "GENERATE PRESCRIPTION") { try { checkforPRID.generateprescription(label65.Text, textBox17.Text, textBox15.Text + " " + textBox13.Text, this.special_id, this.name, label66.Text); checkforPRID.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Prescription generated successfully", "Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { MessageBox.Show("Please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"select patient_id as 'Special ID', patient_name as 'Name', dignose from M3dic.patients_appointment where doctor_name = '{this.name}' ", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView2.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { checkforPRID.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Prescription updated successfully", "Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); string query = "datasource=35.205.24.161;port=3306;username=m3dic;password=\"M3dic\""; MySqlConnection conDataBase = new MySqlConnection(query); MySqlCommand cmdDataBase = new MySqlCommand($"select patient_id as 'Special ID', patient_name as 'Name', dignose from M3dic.patients_appointment where doctor_name = '{this.name}' ", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmdDataBase; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bSorce = new BindingSource(); bSorce.DataSource = dbdataset; dataGridView2.DataSource = bSorce; sda.Update(dbdataset); } catch (Exception) { MessageBox.Show("Database error, please contact support", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button13_Click(object sender, EventArgs e) { try { doctorSQL updatediagnose = new doctorSQL(); updatediagnose.UPdateDIAGNOSE(textBox17.Text, textBox20.Text); MessageBox.Show("Successfully updated diagnose user: "******" - diagnose updated", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); } catch (Exception) { MessageBox.Show("Please contact admin", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }