NULL in Reports RRS feed

  • Question

  • I have a report that displays a set of records in a table.  There is one field (a date field) which can have a NULL value.  I find that if the first record in the datatable has NULL in the date field, then none of the dates display at all.  The rest of the data displays, just nothing appears in the date column.  If the first record in the datatable contains a valid date, then all of the records with dates print fine, and the ones with NULLs print #Error in the date column.  This does not only affect dates, but I've tested it with other datatypes as well.  Basically, if there is a NULL in the first record, then no values print in that column at all.
         This behavior is only apparent with SQL Reports designed in visual studio 2005 and ran from within the application.  Reports that are deployed to the ReportServer and ran from the SQL report manager work fine and don't see this behavior.  However, I need the reports stored and ran from within the application.  Thank you in advance for any help you can provide.
    Tuesday, October 31, 2006 5:37 PM


  • I solved my own problem.  When setting up the binding source that is going to be used as the datasource for the report, you have to be careful how you set the binding source properties.  I originally had the following:

    BindingSource1.DataSource = DataSet1.Datatable

    However, this produced the erroneous behavior.  I needed to make use of the DataMember property of the binding source as such:

    BindingSource1.DataSource = DataSet1
    BindingSource1.DataMember = "DatatableName"

    This produces the correct results.  From what I have experienced, using the datasource property alone to directly point to the datatable is a *** shoot.  Most of the time, it produces the expected behavior, but sometimes it doesn't.  Setting the datamember property is necessary to prevent certain problems.
    Wednesday, November 1, 2006 3:19 PM