none
Drillthrough report error (data source instance has not been supplied) RRS feed

  • Question

  • Hi,

    Firstly let me say that i have checked similar incidents on this forum but was unable to find a solution to my proablem.

    I have a report, lets call it mainReport that has a drillthrough link to a second report, lets call it detailReport. Both reports are local and both use the same object as a data source, lets call the object myDataObject. The mainReport passes a value to the detailReport as a paramter (the parameter may be null).

    I add the data source to the report as follows:

    Code Snippet

    Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

    reportDataSource1.Name = "Dohems_Playback_myDataObject";
    reportDataSource1.Value = this.myDataObjectDataBindingSource;
    this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1);




    After this i bind to the data object:

    Code Snippet

    List<myDataObject> dataList = new List<myDataObject>();

    while(reader.Read())
    {
        myDataObject data = new myDataObject(reader);
        dataList.Add(data);

    }

    myDataObjectDataBindingSource.DataSource = dataList;
    reader.Close();

    this.reportViewer1.RefreshReport();


    The report mainReport loads correctly. However, when i attempt to drillthrough to the report detailReport the following error message is displayed:

    A data source instance has not been supplied for the data source "Dohems_Playback_myDataObject".

    What is so confusing is that both reports use the same data source. So if the first report loaded ok, why does the drill throuh report give me this trouble. When i make the report detailReport the first report to load there are no problems.

    Can anyone please help me with this matter. Any advice or assistance would be greatly appreciated.

    Wednesday, February 13, 2008 2:02 PM

Answers

  • The problem is that you are supplying the data source to the parent report, not the drillthrough report.  You will want to handle the Drillthrough event on the ReportViewer object and supply the data source to the drillthrough report that is exposed via the event args.  The report object on that event arg is the same type as ReportViewer.LocalReport, so you supply the binding in exactly the same way.

    Friday, February 15, 2008 3:49 AM
    Moderator

All replies

  • The problem is that you are supplying the data source to the parent report, not the drillthrough report.  You will want to handle the Drillthrough event on the ReportViewer object and supply the data source to the drillthrough report that is exposed via the event args.  The report object on that event arg is the same type as ReportViewer.LocalReport, so you supply the binding in exactly the same way.

    Friday, February 15, 2008 3:49 AM
    Moderator
  • Thank you, that solved my problem
    Thursday, February 21, 2008 7:02 AM