Click here to Skip to main content
15,346,290 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good Day

Have a win Forms app developing, SQL Database then DSR.xsd Dataset for report
Export Data from Datatable to DSR Dataset - No issues there
Can Get Data into ReportViewer Datatable for parent Report but Not able to Get Sub-Report Data into datatable

VB.NET
Public Class Frm_RptProjReg
    Private Sub Frm_RptProjReg_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Name = "Project Drawing Register"
        Me.Text = "Project Drawing Register"

        RptVw.Reset() 'RptVw  = ReportViewer
        RptVw.ProcessingMode = ProcessingMode.Local 'Winforms Application
        RptVw.LocalReport.DataSources.Clear() 'Remove any previos config

        Dim Dtr As DataTableReader
        Dtr = New DataTableReader(DtRptProjDisc) 'Datatable DtRptProjDisc has preloaded data
        DSR.Dt_RptProjDisc.Load(Dtr) 'Get Data from Datatable into DSR(DSR.xsd dataset required for rdlc rpt)
        RptProc("Grd_Rpt.Rpt_ProjRegMain.rdlc", "DS_ProjRegDisc", "Dt_RptProjDisc") 'Run Main Report sub 

        Dim DtrRptProjFle As DataTableReader
        DtrRptProjFle = New DataTableReader(DtRptProjFle) 'Datatable DtRptProjFle has preloaded data
        DSR.Dt_RptProjFle.Load(DtrRptProjFle) 'Get Data from Datatable into DSR(DSR.xsd dataset required for rdlc rpt)
        RptSubProc("Grd_Rpt.Rpt_ProjRegFle.rdlc", "DS_ProjRegFle", "Dt_RptProjFle") 'Run Sub Report Sub

        'PgCnf() ' Sub to configure ReportViewer Page Size
        RptVw.LocalReport.Refresh()
        RptVw.RefreshReport()

        '*** still have to configure sub report parameters but unable to get sub report data so far?
        'Dim parameter As ReportParameter
        'parameter = New ReportParameter("xDisc", "xDisc")

    End Sub

    Private Sub RptProc(_RdlcRpt As String, _Dataset As String, _DataTable As String)

        Dim Rds As New ReportDataSource(_Dataset, DSR.Tables(_DataTable))
        RptVw.LocalReport.DataSources.Add(Rds) 'Add Datasorce to Reportviewer

        Dim Assy As Assembly = Assembly.LoadFrom("Grd_Rpt.dll") 'Get Embedded Resource

        Dim Strm As Stream = Assy.GetManifestResourceStream(_RdlcRpt) 'Get Stream for rdlc rpt file
        RptVw.LocalReport.LoadReportDefinition(Strm) 'Load rdlc rpt into reportviewer

    End Sub
    Private Sub RptSubProc(_RdlcRpt As String, _Dataset As String, _DataTable As String)

        Dim Rds As New ReportDataSource(_Dataset, DSR.Tables(_DataTable))
        RptVw.LocalReport.DataSources.Add(Rds)  'Add Datasorce to Reportviewer **This may be incorrect 'LocalReport?' as Sub Report?

        Dim Assy As Assembly = Assembly.LoadFrom("Grd_Rpt.dll")  'Get Embedded Resource

        Dim Strm As Stream = Assy.GetManifestResourceStream(_RdlcRpt) 'Get Stream for rdlc rpt file
        RptVw.LocalReport.LoadSubreportDefinition(_RdlcRpt, Strm) 'Load rdlc sub rpt into reportviewer **May be incorrect

    End Sub

End Class


What I have tried:

Have Tried Google Search
Reconfigure RDLC Report Vesions - did not work
Static Report Configuration
Various Code examples tried - no viable solution found
Posted
Updated 2-Nov-21 0:40am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900