none
ReportViewer: Datasource error while "data source instance has not been supplied for the data source" while navigating to 2nd report

    Question

  • Hi,

    I'm developing some WinForm reports in VS.NET 2010 using Report Viewer.    There are 2 reports namely report1.rdlc and report2.rdlc.

    On clicking on any row in the tablix control of report1.rdlc, with "Go to report" options and parameters set properly,   I am successfully able to naviagate to the 2nd report report2.rdlc, and I can display the values of the parameters passed in the 2nd report.  

    However, when I add a tablix in the report2.rdlc with dataset set "SubRepDataset" set, it is throwing an error "data source instance has not been supplied for the data source".

    I am not using subreport control or want the drill-down below the rows itself.  I basically need to move to the report2.rdlc which uses different datasource.

    I'm not getting this error when I run the report2.rdlc separately.   The datasource error comes only on clicking the rows in the report1.rdlc.

    I did create identical dataset called "SubRepDataset" and filling it in the report1.rdlc.    Can somebody help me how to transfer or point datasource from one report to another?

     

    This is my code to call the first report from a standard winform having reportviewer control "rptview".

        With rptReports

                .Reset()
                .ProcessingMode = ProcessingMode.Local

                .LocalReport.ReportEmbeddedResource = "MyApp.Report1.rdlc"
                .LocalReport.DataSources.Clear()

                dtRepTable= Me.TableAdapter1.GetData
                dtRepSubTable= Me.TableAdapter2.GetData


                rdsRep.Name = "RepDataset"
                rdsRep.Value = dtRepTable
                .LocalReport.DataSources.Add(rdsRep)

                rdsSubRep.Name = "SubRepDataset"
                rdsSubRep.Value = dtRepSubTable
                .LocalReport.DataSources.Add(rdsSubRep)
       

                 .RefreshReport()
        End With

    Sunday, September 11, 2011 3:22 AM

Answers

All replies