views:

359

answers:

1

Hi,

I have a SSRS (SQL Server Reporting Services) RDLC local mode report that is populated by an object data source. However the data from the database is returned as 0 but the report is displaying blank.

My datasource is a List<> of a type "ReportData" that is populated from a SQL Server query.

public class ReportData
{
    public object column1 { get; set; }
    public object column2 { get; set; }
    public object column3 { get; set; }

    public ReportData(object column1, object column2, object column3)
    {
     this.column1 = column1;
     this.column2 = column2;
     this.column3 = column3;
    }
}

Like this:

List<ReportData> results = new List<ReportData> {};

while (dr.Read())
{
    results.Add(new ReportData(dr[0], dr[1], dr[2], dr[3]));
}

Through debugging I confirm that the List is populated with values of "0" and that they are being turned into Decimals objects (The original SQL Server field is money type).

I then bind it to the ReportViewer control via:

ReportViewerControl.LocalReport.DataSources["ObjectDataSource"].Value = results;

And just use it normally inside the report (I added the datasource and use the "Website Data Source" panel to drag the values onto a table), as stated its not displaying "0" but just blank.

I am using Visual Studio 2008 with I presume the ReportViewer 2005 control (Microsoft not giving Local Mode tablix :() and querying a SQL Server 2008 x64 Standard instance.

Anyone got any clue why its not showing zeros?

Phil

+1  A: 

It appears if you have a format expression of say "###,###,###.##" on a zero value it makes it blank. Just removed the format expression for the certain cases where zero values can occur and its fix.

Phil