SSRS report not displaying data-Collection of common programming errors

I had the same problem. Here is what I found. Here is my code:

    DECLARE @tblPigProblems TABLE (
    Id          INT IDENTITY, 
    PPId            INT, 
    GaugeColor      VARCHAR(25), 
    FullStartTime       VARCHAR(25), 
    PigSystem         VARCHAR(25)
    )

    IF (1 = 0)
    BEGIN
        SELECT * FROM @tblPigProblems
    END

    ...

    SELECT '@tblPigProblems'    [PigProblems],  
    @p_vchLine      [Line],         
    GaugeColor      [Product],
    FullStartTime       [Start Time],
    PigSystem       [Pig System]
FROM @tblPigProblems

What I did was to use the initial “SELECT * FROM @tblPigProblems” to ensure that if any error messages were specified in the code before the final select statement returning the dataset, that SSRS was able to determine the fields from the stored procedure. Then, when the results were determined, I assigned an alias to the fields. The problem was that the aliases for the fields did not match the declared field names (ie: the declared field “GaugeColor” did not match the alias “[Product]” I supplied in the select to create the result set. The way that I realized this is that when I refreshed the fields in the Data section of the SSRS report, then displayed the dataset fields, it listed the field names from the table declaration (ie: “GaugeColor”). When I executed the stored procedure within the dataset (clicked on the !), the result set listed in SSRS showed the field aliases (ie: “Product”). Since these didn’t match, nothing was displayed in the textbox I had assigned the field to (ie: “=Fields!ColorGauge.Value”). SSRS did not pick up this discrepancy and allowed the report to be created, but no values to be displayed. The fix was simple, replace:

    IF (1 = 0)
    BEGIN
        SELECT * FROM @tblPigProblems
    END

with:

    IF (1 = 0)
    BEGIN
        SELECT '@tblPigProblems'    [PigProblems],  
        @p_vchLine      [Line],         
        GaugeColor      [Product],
        FullStartTime   [Start Time],
        PigSystem       [Pig System]
    FROM @tblPigProblems
    END

Dan