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

后端 未结 7 1155
伪装坚强ぢ
伪装坚强ぢ 2021-02-06 20:07

I\'m working on an application where one can get information on movies from a database as well as add, update and delete the movies. In the database I have three tables (Movie,

7条回答
  •  春和景丽
    2021-02-06 20:57

    Today I've faced this issue. But mine has been fixed in another way. If someday anyone stumbled the answer is for them.

    As this is a generic C# .NET CLI exception

    I've added a new foreign key to one of my DB table with no default value. Thus the value was set to NULLas that column was set to allow null. And I've been getting this exception while querying on that table.

    As solution, I replaced the NULL values with appropriate values (as they are foreign key' they should be appropriate).

    That's all.

    Thank you.

提交回复
热议问题