locked
ArgumentException: "An Item with the same key has already been added" error trying to add Stored Procedures to the model RRS feed

  • Question

  • I am trying to add a number of Stored Procedures to my model in VS2010 project.  The model doesn't contain any stored procedures prior to the add operation.  When I try to add the selected SPs I get an ArgumentException error with message "An Item with the same key has already been added".

    I took a look at the metadata query that EF runtime is running the get the SP information and the returned result set looks as follows:

    c1          c2           c3            c4       c5     c6     c7     c8     c9        c10    c11  

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

              1 newton       sp_0p_0r      -             0      0      0      0 -         -      -    

              1 newton       fun_1p_1r     date          0      1      0      0 delta     int    IN   

              1 newton       sp_1p_0r      -             0      0      0      0 par1      int    IN   

              1 newton       sp_1p_1r      date          0      1      0      0 delta     int    IN   

              1 newton       sp_2p_6r      -             0      0      0      0 p_id      int    IN   

              1 newton       fun_1p_4rr    -             0      0      0      0 maxid     int    IN   

              1 newton       sp_2p_6r      -             0      0      0      0 p_echo    char   IN   

              1 newton       sp_1p_4rr     -             0      0      0      0 maxid     int    IN   

              1 newton       fun_2p_6r     -             0      0      0      0 p_id      int    IN   

              1 newton       fun_2p_6r     -             0      0      0      0 p_echo    char   IN  

    Adding SPs one by one I discovered that the SP causing the issue is "fun_2p_6r".  What I am trying to understand is why!  The result set doesn't seem to have any duplicate records, so there shouldn't be any key collision.

    Any help with this issue would be greatly appreciated.

    Thanks,

    Alex

    Tuesday, April 24, 2012 11:54 PM

All replies

  • Hi Alex,

    Welcome!

    According to your description, I'm not sure about your question, the selected SPs could cause "An Item with the same key has already been added" exception? there is not any insert operation, Is there any other information about your project.

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 25, 2012 1:22 PM
  • Hi Alan,

    I am not sure I understand what you mean by "insert operation".  The exception I am seeing is being thrown by "Update Model from Database" wizard after I select the SPs I want to add and click OK.

    Wednesday, April 25, 2012 3:57 PM
  • Hi,

    Mostly like, there are same columns names returning from your SPs, here is a link: http://arcanecode.com/2010/07/30/ssrs-quick-tip-an-item-with-the-same-key-has-already-been-added/ 


    I am fish.

    Monday, May 7, 2012 7:13 AM