If you are using EF then you may get the error. This error is not specify where the error exactly occur in your table. To specify the error use this code & use debugger to see the exact error message. try { //Your code db = new FEDALIC_AGRI_DBEntities (); model.FarmerVillage = new Guid(village); model.FarmerThana = new Guid(thana); model.FarmerDistrict = new Guid(district); var _SET_FARMER_INFO = EMFermar.SetToModelObject(model); db.SET_FARMER_INFO.Add(_SET_FARMER_INFO); db.SaveChanges(); } catch (DbUpdateException e) { var innerEx = e.InnerException; while (innerEx.InnerException != null) innerEx = innerEx.InnerException; throw new Exception(innerEx.Message); } catch (DbEntityValidationException e...
Work smarter, not harder.