DialogResult dresult = MessageBox.Show("确定删除员工信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (dresult == DialogResult.Yes)
{
string str = @"Data Source=.;Integrated Security=True;Initial Catalog=考勤管理系统";
SqlConnection con = new SqlConnection(str);
string MyDelete = "Delete from 员工 where 员工号='" + textBox17 .Text +"'";
SqlCommand cmd = new SqlCommand(MyDelete, con);
try
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
textBox17 .Text = "";
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
}
这样也不行
if (dresult == DialogResult.Yes)
{
string str = @"Data Source=.;Integrated Security=True;Initial Catalog=考勤管理系统";
SqlConnection con = new SqlConnection(str);
string MyDelete = "Delete from 员工 where 员工号='" + textBox17 .Text +"'";
SqlCommand cmd = new SqlCommand(MyDelete, con);
try
{
con.Open();
cmd.ExecuteNonQuery();
con.Close();
textBox17 .Text = "";
}
catch (Exception ex)
{
Console.WriteLine("{0} Exception caught.", ex);
}
}
这样也不行