Error :the cast to value type "Double" failed because the materialized
value is null
i have a star_tbl . i wanna make starpart in my web site. my cod:
public int StarProduct(int id_Product)
{
return Convert.ToInt32(db
.tbl_satar_Product
.Where(p => p.Id_Product == id_Product && p.star != null)
.Average(s => s.star));
}
but t shows this error :
the cast to value type "Double" failed because the materialized value is
null. Either the result type 's generic parameter or the query must use a
nullable type.
No comments:
Post a Comment