谁能说出下面的代码有什么问题?
command.Connection = ConnectionManager.GetConnection();
command.CommandText = "Update Table1 SET Replaceme = ? WHERE Searchme = ?";
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("Replaceme", "Goodman");
command.Parameters.AddWithValue("Searchme", "Anand");
command.Connection.Open();
int recordsaffected = command.ExecuteNonQuery();
MessageBox.Show("Records affected : " + recordsaffected);
MessageBox
显示 0 条记录,它实际上并没有更新可用的记录。
表名(Table1)
和列名(Replaceme and Searchme)
拼写正确。