private void toolStripButton3_Click_1(object sender, EventArgs e) { int damage = Convert.ToInt16(numericUpDown1.Value); UGIcon.Open(); cmd = new SqlCommand("select * from purchase", UGIcon); SqlDataReader s = cmd.ExecuteReader(); while (s.Read()) { if (toolStripTextBox1.Text != s["cm"].ToString()) { MessageBox.Show("Please check the name"); } else { if (textBox2.Text == "") { errorProvider1.SetError(textBox2, "Provide Owner name"); } else if (textBox3.Text == "") { errorProvider1.SetError(textBox3, "Provide Address"); } else if (numericUpDown2.Value >= damage) { MessageBox.Show("check Damage quantity"); } else if ((maskedTextBox1.Text.Trim().Length <= 10)) { MessageBox.Show("Provide full phone number"); } else { cmd = new SqlCommand("update purchase set om='" + textBox2.Text + "', address='" + textBox3.Text + "', phone='" + maskedTextBox1.Text.ToString() + "',baled='" + numericUpDown2.Value + "',paid='" + textBox9.Text + "' where cm='" + toolStripTextBox1.Text + "'", UGIcon); SqlDataReader dr; dr = cmd.ExecuteReader();//There is already an open DataReader associated with this Command which must be closed first. dr.Close(); MessageBox.Show("Details has been updated sucessfully", "Update Window", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } s.Close(); UGIcon.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)