private void button3_Click(object sender, EventArgs e) { try { cn.Open(); SqlCommand cmd3 = new SqlCommand("delete [EtatDePassment] where CodePatient='" + CodePtxt.Text + "'", cn); SqlCommand cmd2 = new SqlCommand("delete RDV where CodePatient='" + CodePtxt.Text + "'", cn); SqlCommand cmd = new SqlCommand("delete Patient where CodePatient='" + CodePtxt.Text + "'", cn); DialogResult r = MessageBox.Show("Voulez-vous vriment Supprimer ce Patient", "Supprission", MessageBoxButtons.OKCancel); if (r == DialogResult.OK) { cmd3.ExecuteNonQuery(); cmd2.ExecuteNonQuery(); cmd.ExecuteNonQuery(); button3.Enabled = false; button2.Enabled = false; CodePtxt.Clear(); NomPtxt.Clear(); PrénomPtxt.Clear(); AdressePtxt.Clear(); TelephonePtxt.Clear(); radioButton1.Checked = false; radioButton2.Checked = false; DateNPtxt.Text = DateTime.Now.ToShortDateString(); } cn.Close(); } catch { MessageBox.Show("Supprission n'est pas réussite"); } }
private void button4_Click_1(object sender, EventArgs e) { CodePtxt.Clear(); NomPtxt.Clear(); PrénomPtxt.Clear(); AdressePtxt.Clear(); TelephonePtxt.Clear(); DateNPtxt.Text = DateTime.Now.ToShortDateString(); radioButton1.Checked = false; radioButton2.Checked = false; NomPtxt.Enabled = false; PrénomPtxt.Enabled = false; AdressePtxt.Enabled = false; TelephonePtxt.Enabled = false; DateNPtxt.Enabled = false; radioButton1.Enabled = false; radioButton2.Enabled = false; button2.Enabled = false; button3.Enabled = false; }