这是我的代码,否则条件不执行
SqlCommand cmd = new SqlCommand(@"DELETE FROM Demo_Table WHERE (ID = '"+textBox1.Text+"')",con);
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
sda.Fill(dt);
count = Convert.ToInt32(dt.Rows.Count.ToString());
if ((textBox1.Text == string.Empty) && (textBox2.Text == string.Empty))
{
MessageBox.Show("Provide ID and PASSWORD");
textBox1.Clear();
textBox2.Clear();
textBox1.Focus();
}
else if (textBox1.Text == string.Empty)
{
MessageBox.Show("select ID to delete record");
textBox2.Clear();
textBox1.Focus();
}
else if (count == 0)
{
MessageBox.Show("wrong ID");
}
else
{
MessageBox.Show("Record Deleted");
}
请帮助…………
胡说叔叔
相关分类