locked
DataView as a LocalReport ReportDataSource RRS feed

  • Question

  •  

     

    Has anyone successfully used a DataView as a ReportDataSource in a LocalReport?

     

    ReportViewer displays a LocalReport as expected when the following steps are performed:

    1. instantiate a ReportDataSource object

    2. set the ReportDataSource Name property to a string of "DataSetName_TableName" format

    3. set the ReportDataSource Value property to a reference of a DataTable contained in a DataSet (ie dsName.Tables[0])

     

    However, I have not been able to display the report using a DataView as a ReportDataSource.

     

    The DataView works as expected with DataGridView.

     

    The DataView is created at run time, therefore there is no DataView data source to select from data sources at design time.  It thereby seems that the DataView will have to be added as a DataSource to the LocalReport.DataSources collection at run time.

     

    In the MSDN library at: ms-help://MS.MSDNQTR.v90.en/rs_vsrptoverview/html/c74c9cae-3621-92dc-5473-e16b920e0837.htm (ReportDataSource.Value Property) it states in the Remarks section:

    Value may be an instance of System.Data.DataTable, a System.Collections.IEnumerable value (for example, System.Data.DataView or .....

     

    The constructor for ReportDataSource has three overloads (), (string), and (string, object).

    I have tried the following without success after instantiating a ReportDataSource rds = new ReportDataSource()

    and created a dataview dvName:

    1.  rds.Name = "dvName", rds.Value = dvName

    2.  rds.Name = "dvName"

     

    Thanks for any insights.

    Monday, February 11, 2008 2:00 PM