An exception occurred while reading a database value for property ‘ ‘. The expected type was ‘System.Int32’ but the actual value was null.

Solution:

Since the table values can be zero, they must be nullable in the data model with a question mark after the variable type

This makes the variable nullable in Asp.Net class

        public bool? has_Profil_Image { get; set; }

public bool? has_Main_Image { get; set; }

public DateTime?  dtCreated { get; set; }

Add Comment