Entity Framework Error: The field is required

Last Reply 9 months ago By pandeyism

Posted 9 months ago

As i have created Entity framework the table have been selected but if i want to select multiple table the error is occuring.

https://imgur.com/a/205Cfze

Used below code to get the error

https://imgur.com/a/dDcnrbD

                   try
                   {
                       Reason lat = new Reason();
                       // TODO: Add insert logic here 
                       lat.Desc = Lat.Desc;
                       
                       Obj.Reasons.Add(lat);
                       Obj.SaveChanges();
                   }
                   catch (DbEntityValidationException ex)
                   {
                       foreach (var entityValidationErrors in ex.EntityValidationErrors)
                       {
                           foreach (var validationError in entityValidationErrors.ValidationErrors)
                           {
                               Response.Write("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
                           }
                       }
                   }
                   return "Reason Added Successfully";
               }