none
Programmically setting up a ReportViewer for a report ????? RRS feed

  • Question

  • I have a form with a MS ReportViewer control and NO report set in the smart-tag - the control is just dragged&dropped and "dogged in parent container" - the form !

    I have this code to set up the ReportViewer to show a report filled with data:
    1             reportViewer1.LocalReport.ReportEmbeddedResource = "TestDrillDown.L1.rdlc";  
    2             List<TestDrillDown.DataSet1TableAdapters.KSO_L1_TotalAlleOrdreIPeriodeTableAdapter>  
    3                     ds = new List<TestDrillDown.DataSet1TableAdapters.KSO_L1_TotalAlleOrdreIPeriodeTableAdapter>();  
    4             ds.Add(KSO_L1_TotalAlleOrdreIPeriodeTableAdapter);  
    5             reportViewer1.LocalReport.DataSources.Clear();  
    6             reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_KSO_L1_TotalAlleOrdreIPeriode",ds));  
    7             this.KSO_L1_TotalAlleOrdreIPeriodeTableAdapter.Fill(this.DataSet1.KSO_L1_TotalAlleOrdreIPeriode, fraDato, tilDato);  
    8             reportViewer1.RefreshReport();  
    9  
    In line 7 ALL data (a "date for interval start=11-07-2001", a "date for interval end=11-07-2001" and "Total value of all orders in the interval of time"=7156.54) is present. The report layout comes up in the reportviewer BUT:

    the interval start/end dates are the same - 01-01-0001 !
    the "total value orders" is not shown so I think it's zero in the report

    What is wrong or what do I miss to get the data shown in the reportviewer ?

    Best regards KSor, Denmark
    • Edited by Ksor Monday, September 22, 2008 7:55 PM spelling
    Monday, September 22, 2008 7:52 PM

All replies

  • Hi
       I don't understand why are you adding table adapter list as report data source. I think that you should change:
    reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_KSO_L1_TotalAlleOrdreIPeriode",ds));
    to:
    reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_KSO_L1_TotalAlleOrdreIPeriode",this.DataSet1.KSO_L1_TotalAlleOrdreIPeriode));


    everything is a matter of probability...
    Tuesday, September 23, 2008 10:45 AM