2
Answers

cast to value type 'System.Int32' failed because the materialized

Garima Bansal

Garima Bansal

1y
2.5k
1

I have the following code. I'm getting error: 

The cast to value type 'System.Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.

var MaxValue = (from t in context.ppatalukmasters where t.regioncode == model.regioncode select t.talukcode).Max();

 

How can i modify?

Answers (2)