SQL Server Reporting Services Field Error Part 2

So here is another solution to the following error message:

The data set "DataSetName" contains a definition for the field "FieldName". This field is missing from the returned result set from the data source.

This can happen in report designer when you are returning a stored procedure results wth uncommon or badly named fields such as the following:

First Name Last Name

Eric Charran

Clark Kent

 

The issue is twofold. First, the Report Designer does not always pick up on the field names and populate the fields tab when you are using a stored procedure. This often means that you'll have to go into the tab directly and enter in the field names. Secondly, Reporting Services attempts to replace every nonstandard character with an underscore. Thus, in my above example, the field name will actually be regarded by Reporting Services as

First_Name

Last_Name

Thus, if you put in the field name manually as "First Name" or FirstName or anything but First_Name, you will get the above error message. Now, in the case where you have a hundred fields coming back from a stored procedure (You Never Should) and don't feel like typing in all those field names (you don't have to enter what you don't use remember), just copy the EXEC statement from query anlyzer to make the stored procedure return rows. In the data set editor in Reporting Services, past in this text and make sure the CommandType is text. This will force the population of the Fields tab. You can then switch it back to stored procedure later.