C# Update statment failed Error: _COMPlusExceptionCode = -532459699
I have a method which updates a table as below :
public static Boolean updateRequest(String _VUserName, DateTime newToDate)
{
SqlConnection conn = getConnection(开发者_C百科);
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();
}
but it failed with _COMPlusExceptionCode = -532459699 exception
any help?
Please check the following link "SQL Server refusing to add a record because it didn't conform to table column specifications"
It looks like it has to do with your update statement. Rather rewrite it like this.
"UPDATE Requests SET [To] = @ToDate WHERE ...
精彩评论