Sie sind auf Seite 1von 1

void delete()

if ((textBox1.Text == "") || (textBox2.Text == "") || (comboBox1.Text == "")||


(textBox3.Text == "")|| (textBox4.Text == "")|| (textBox5.Text == "")||
(textBox6.Text == ""))
{
MessageBox.Show("Please select some recored");
}
else
{

DialogResult del = MessageBox.Show("Are you Sure you want to delete the :" +
textBox1.Text + , "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

if (del == DialogResult.Yes)
{
con.Open();

SqlCommand cmd = new SqlCommand("DELETE from login WHERE (username='" +


textBox1.Text + "')", con);
cmd.ExecuteNonQuery();

con.Close();
MessageBox.Show("Record Deleed Successfully!");
displaydata();
clear();
}
else
{
this.show;
}
}

Das könnte Ihnen auch gefallen