Wednesday, October 23, 2019 at 16:21:13
Whilst designing a report for deployment to SSRS from Visual Studio 2015, I received this error message when entering a SQL query I knew worked in to the New Report wizard:
An error occurred while the query design method was being saved. An item with the same key has already been added.
This is a classic Microsoft error message that is both specific and vague at the same time… and also shouldn’t happen. There are scant details online as to where this comes from but is a result of Microsoft SQL Server Report Designer having a requirement for unique column names (even if the underlying SQL query returns unique columns with the same name). This is a stupid limitation and whilst the error message is accurate, it is sufficiently vague to obfuscate what is going on.
The solution - unsurprisingly - is to make sure that there is no repetition in the names of the columns.