Blog Post

"An item with the same key has already been added."

,

In SQL Server Reporting Services, when adding a new dataset to a report, you may see an error that looks like this:

"An item with the same key has already been added."

Based on some quick googling, it looks like there are several potential causes for the error, but here's why I received it today.

The stored procedure I had declared as the query source had the same column name declared twice.  Even if you use different data from different tables, even if you declare them differently, SSRS needs all column names in the final dataset to be unique.

select
tablea.samecolumnname
,tableb.samecolumnname
,samecolumnname = tablec.columnname
,tabled.columnname as samecolumnname
...

That error message isn't helpful, but that was the solution for me, for what was a clumsy mistake to begin with.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating