1
Answer

Window Application c# ConstraintException error

Kurt

Kurt

11y
1k
1
Hello All,

I am relatively new to C# programming and seek your assistance in solving this constraint exception error.

I and using a bindingnavigatortoolbar each time a click the add button i get this error "This property cannot be set to a null value " and this occurs at the line " _OtherPhone = StructuralObject.SetValidValue(value, false); " 

[EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String OtherPhone
        {
            get
            {
                return _OtherPhone;
            }
            set
            {
                OnOtherPhoneChanging(value);
                ReportPropertyChanging("OtherPhone");
                _OtherPhone = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("OtherPhone");
                OnOtherPhoneChanged();
            }
        }
        private global::System.String _OtherPhone;
        partial void OnOtherPhoneChanging(global::System.String value);
        partial void OnOtherPhoneChanged();
N.B. Entity Framework is been used to connect to the database. (windows application) The error does not happen on all fields. The database table is setup not to accept null values

Can someone say how i correct this problem. Thanks in advance
Answers (1)