Unable to bind DataTable to subreport. RRS feed

  • Question

  • Hello everyone..

    I'm trying to add subreport to MicrosoftReportViewer control.
    I added the subreport control to the main report (reportViewer3) and created new report to attached to the subreport. Also I attached to the subreport a DataSource named "NetDataSet_ShowBookResForEachShop" that contain 2 fields: name, amount.
    I also attache to the main report event (SubreportProcessingEventHandler) to handle the processing of the subreport.

    The problem is thae even that the event working just fine (thisDt is a table contains 2 coulmns named: name & amount filled with data) I'm getting the error "Error: Subreport could not be shown" instead of the subreport itself.

    I sure that somthing is missing but I can't fugure that out.

    Attached code snap.

    Thank's in advance for your help, 



    void reportViewer3_Load(object sender, EventArgs e)


          reportViewer3.LocalReport.SubreportProcessing +=

    new SubreportProcessingEventHandler(SubreportProcessingEventHandler);


          reportViewer3.ProcessingMode = Microsoft.Reporting.WinForms.





    void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)



        SqlConnection thisConnection = new SqlConnection(localLookUp.Instance().ConnectionString);


        DataTable thisDt = new DataTable();

        thisDt =

    localLookUp.Instance().SearchDB("EXEC ShowBooksResForEachShop '3220618','1/1/1888'");


    new ReportDataSource("NetDataSet_ShowBooksResForEachShop", thisDt));


    Sunday, April 26, 2009 10:45 AM