I’m getting this error when trying to update a row in DB through stored procedure
Procedure or Function ‘sp_A_Update’ expects parameter ‘@Misc’, which was not supplied.
but I HAVE supplied it with this:
command.Parameters.AddWithValue("@Misc", inspection.Misc);
Here is my whole code with other parameters taken out to shorten
using (SqlCommand command = new SqlCommand("sp_Agent_Inspection_Update", new SqlConnection (Configuration.ConnectionString)))
{
command.CommandType = CommandType.StoredProcedure;
PropertyInfo[] propertyInfo = inspection.GetType().GetProperties();
command.Parameters.AddWithValue("@Misc", inspection.Misc);
(lots of other params here...)
command.Parameters.AddWithValue("@RepairNotes", inspection.RepairNotes);
// OPEN CONNECTION
command.Connection.Open();
// EXECUTE QUERY
int rowsAffected = command.ExecuteNonQuery();
command.Connection.Close();
return Boolean.Parse(rowsAffected.ToString());
}
Does anyone have any ideas?
Apart from the obvious mistake about the name of the stored procedure you are calling.