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.SetValidV
TypeScript
[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();VB.NET
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 valuesCan someone say how i correct this problem. Thanks in advance
Amit ChoudharyRank #145 · 15.8K reputationPosted Jun 17, 2013, 9:48 AM EDT
When you're encountering this exception during debugging on this line, look at the call stack in Call Stack window in Visual Studio. Just look for the last statement where this property is being called for Set operation. That should be source of your problem.