我有一个更新表格的方法如下:
public static Boolean updateRequest(String _VUserName, DateTime newToDate)
{
SqlConnection conn = getConnection();
SqlCommand command = new SqlCommand();
command.CommandText = "UPDATE Requests SET [To] = @ToDate FROM Requests INNER JOIN "+
"VUsers ON Requests.UserRef = VUsers.VUserID WHERE (VUsers.VUserName = @VUserName)";
command.Parameters.AddWithValue("@ToDate", newToDate);
command.Parameters.AddWithValue("@VUserName", _VUserName);
conn.Open();
try
{
command.ExecuteNonQuery();
return true;
}
catch (Exception)
{
return false;
}
conn.Close();
}
但是_COMPlusExceptionCode = -532459699异常
失败了任何帮助?
答案 0 :(得分:0)
请检查以下link“SQL Server拒绝添加记录,因为它不符合表列规范”
它看起来与您的更新语句有关。而是像这样重写它。
"UPDATE Requests SET [To] = @ToDate WHERE ...