The “X” property on “Y” could not be set to a 'null' value. You must set this property to a non-null value of type 'Int32'

前端 未结 11 1383
花落未央
花落未央 2020-12-29 21:38

When I run my application and I click a specific button I get the error:

\"The \"X\" property on \"Y\" could not be set to a \'null\' value. You must set thi         


        
11条回答
  •  感情败类
    2020-12-29 21:55

    to fix the error

     Error 3031: Problem in mapping fragments starting at line 4049:Non-nullable column "X" in table "Y" is mapped to a nullable entity property.
    

    open your EDMX file with and xml editor and lookup you table in

    edmx:StorageModels

    find the propertie which gives the error and set or add

    Nullable="false" >> to Nullable="true"

    save the edmx, open it in visual studio and build it. problem solved

提交回复
热议问题