find and solve || findandsolve.com
Please wait.....

How to solve when updating EDMX error An entry with the same key already exists

How to solve when updating EDMX error An entry with the same key already exists

---------------------------

Microsoft Visual Studio

---------------------------

An exception of type 'System.ArgumentException' occurred while attempting to update from the database. The exception message is: 'An entry with the same key already exists.'.

---------------------------

OK    

---------------------------

I've added a new table in my database and now I want to update the model. ... An exception of type 'Microsoft. ... ConnectionStringConverterServiceException' occurred while attempting to update from the database  the exception message is: 'An entry with the same key already exists.'.


Answer

You probably have two identical nodes: EntitySetMapping.You should remove one and everything will be ok.


Answer


  1. Deleted all tabels from the <name>.edmx model that contained the reference or what ever that was causing the error.
  1. And the right clicked the designer and click "Update Model from Database" again and all was fixed.

I think this step working fine.In my case i  have solved  my problem by given above step.

Answer

If your error is not solved by above code  i think there is a problem in your connection string its solve as given below step.Please copy and paste your connection string into your app.config/web.config whatever config file you are using.

1) First open your.edmx file

2) And then click on blank space in that model
3) you will see the Properties panel in the right side of the window.
4) choose connection string just copy and paste in your config file

Hope you will be able to avoid from getting exception anymore.

Mahira  khanna

Mahira khanna

I have the skills you need for you company blog, website, or other content materials

If findandsolve.com felt valuable to you, feel free to share it.

Comments



Report Response