Wednesday, October 21, 2015

The specified cast from a materialized 'System.Int16' type to a nullable 'System.Int32' type is not valid.

Based from the issue, the fix is to check the database field against the view model class. In my case, the database field is smallint (nullable).
So, the fix is to change the model code from:
 public int? StockOnHand { get; set; }  
 public Int16? UnitsInStock { get; set; }  


Post a Comment