我有一个数据表,我想通过向所有收入低于 30 000 的人额外增加 5000 来更新员工工资。
这就是我所做的,甚至认为实际更新没有发生任何错误。
也许是建议?
string connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=lrmg;Integrated Security=True;";
using (sqlConnect = new SqlConnection(connectionString))
{
sqlConnect.Open();
SqlCommand cmd = sqlConnect.CreateCommand();
cmd.CommandText = "UPDATE [Employee] SET [Salary] += 5000 WHERE [Salary] < 30000";
cmd.ExecuteNonQuery();
sqlConnect.Close();
}
labMessage.Text = "The update was processed";