Click here to Skip to main content
15,847,077 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VS2010 throwing error Data Retrieval Failed for subreport when trying to show subreport in main report.

Here it is my coding:

WfReportViewer.aspx.vb
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Request("ReportName").Equals("sysRptTreatmentProviderLisitng.rdlc")) Then
            SysRptViewer.LocalReport.ReportPath = "sysRptTreatmentProviderLisitng.rdlc"
            reportDS = New ReportDataSource("oDsTreatmentProvLisitng")
SysRptViewer.LocalReport.DataSources.Add(reportDS)
        AddHandler SysRptViewer.LocalReport.SubreportProcessing, AddressOf SetSubDataSource
        SysRptViewer.LocalReport.Refresh()

End Sub


Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
        Try
            reportDS = New ReportDataSource("oDsTreatmentProvMonthlyReport")
            e.DataSources.Add(reportDS)
        Catch ex As Exception
            Throw ex
        End Try

    End Sub


WfReportViewer.aspx
VB
<DataSources> 
  <rsweb:ReportDataSource DataSourceId="oDsTreatmentProvMonthlyReport"  Name="dsTreatmentProvMonthlyReport" /> 
  <rsweb:ReportDataSource DataSourceId="oDsTreatmentProvLisitng"  Name="dsTreatmentProvLisitng" />
</LocalReport>
  </rsweb:reportviewer>
<asp:ObjectDataSource ID="oDsTreatmentProvMonthlyReport" runat="server" OldValuesParameterFormatString="original_{0}" 
    SelectMethod="GetData" TypeName="ISOATS.dsTreatmentProvMonthlyReportTableAdapters.proc_GetTreatmentProviderMonthlyReportInfoTableAdapter">    
</asp:ObjectDataSource>
   
<asp:ObjectDataSource ID="oDsTreatmentProvLisitng" runat="server" OldValuesParameterFormatString="original_{0}" 
       SelectMethod="GetData" TypeName="ISOATS.dsTreatmentProvLisitngTableAdapters.proc_GetTPOffenderAssignedInfoTableAdapter">
</asp:ObjectDataSource>



Please click following link to see reports design and OutPut report with subreport error description:
sysSubRptTreatmentProviderMonthlyReport.rdlc
sysRptTreatmentProviderLisitng.rdlc

http://dotnetgoodbooks.blogspot.com/2012/02/ssrs-subreport-and-main-report.html[^]
Posted
Updated 17-Feb-12 18:22pm
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