Kurt

Kurt

  • NA
  • 1
  • 1k

Window Application c# ConstraintException error

Jun 17 2013 12:01 PM
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)