Wednesday, May 28, 2014

An error occurred while updating the entries. See the inner exception for details.

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.

                 //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);  
       catch (DbUpdateException e)  
         var innerEx = e.InnerException;  
         while (innerEx.InnerException != null)  
           innerEx = innerEx.InnerException;  
         throw new Exception(innerEx.Message);  
       catch (DbEntityValidationException e)  
         var sb = new StringBuilder();  
         foreach (var entry in e.EntityValidationErrors)  
           foreach (var error in entry.ValidationErrors)  
         throw new Exception(sb.ToString());  

[NB: I got this exception because of duplicate primary key when I am going to insert in my table]
Thank you.

Ensure that this project has Microsoft.Bcl.Build installed and packages.config is located next to the project file

In my Xamarin form application their was dependency Restclient on Microsoft.Bcl.Build Microsoft.Bcl. i just remove all using nuget and ...