Home > Articles > Details

SqlNullValueException: Data is Null. This method or property cannot be called on Null values


Question: SqlNullValueException: Data is Null. This method or property cannot be called on Null values.

 


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.

Josh said:

Make sure that the columns returned from database has value in them, or write a stored procedure to replace NULL values with some values.

Posted On: February 18, 2022 14:47:38 PM
Jack said:

The issue is because the data you are trying to retreive from the database has null values hence you are calling .ToList() on it. This will throw an error.

Posted On: February 18, 2022 14:45:38 PM

© 2022 - ErnesTech - Privacy