Reputation: 5892
I know this question has been asked before, but all questions were for reports being accessed using C# or VB.NET code. My problem is that I am building and accessing the report using Business Intelligence studio, I am basically trying to add a sub report for a report, and I made sure from the parameters and they are OK. However when I try to access the report containing the subreport, I get the error
Data retrieval failed for the subreport, 'Subreport1'.
I also tried deleting the .data
files but the same problem persisted.
Upvotes: 6
Views: 36966
Reputation: 715
I faced similar issue in past and in my case below were the culprit's
Parameter from main report is sending null value to sub report.
Data type of parameter were different than actual data type.
Upvotes: 7
Reputation: 11
I had same issue with sub-reports error:
Data retrieval failed for sub report.
I found it was in my case everything to do with my login, I was not using SQL Server login and that was the issue it kept on prompting me for login every now and then.
However I deployed the reports all of them 4 sub reports and one main report, went in the troubled sub report and changed the setting for data source CREDENTIAL STORED SECURELY IN THE REPORT SERVER
Upvotes: 1
Reputation: 51
I was using filters inside the subreport but after doing some research I applied the filter directly into the BindingSource and it worked for me. Here is my code if it helps:
Public Sub SubreportProcessingEventHandler(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
Dim nID As Integer = 0
Select Case e.ReportPath
Case "rptBilans_CU"
nID = e.Parameters.Item(0).Values(0)
Q_Bilans_CUBindingSource.Filter = "IDPATIENT = " & nID
e.DataSources.Add(New ReportDataSource("DataSetCompany", Me.DetailSocieteBindingSource))
e.DataSources.Add(New ReportDataSource("DataSet1", Me.Q_Bilans_CUBindingSource))
Case "rptBilans_Bacterio"
nID = e.Parameters.Item(0).Values(0)
Q_Bilans_BacterioBindingSource.Filter = "IDPATIENT = " & nID
e.DataSources.Add(New ReportDataSource("DataSetCompany", Me.DetailSocieteBindingSource))
e.DataSources.Add(New ReportDataSource("DataSet1", Me.Q_Bilans_BacterioBindingSource))
Case "rptBilans_FNS"
nID = e.Parameters.Item(0).Values(0)
Me.Q_Bilans_FNSBindingSource.Filter = "IDPATIENT = " & nID
e.DataSources.Add(New ReportDataSource("DataSetCompany", Me.DetailSocieteBindingSource))
e.DataSources.Add(New ReportDataSource("DataSet1", Me.Q_Bilans_FNSBindingSource))
End Select
End Sub
Upvotes: 1
Reputation:
I faced this problem when I was not passing the data source for the subreport. This answer helped me https://stackoverflow.com/a/8924617/4795214
Upvotes: 1
Reputation: 700
I had the same problem when the dataset’s subreport filters the data by the "Filters" functionality (Filter tab), but when change the filter method by the use of sql parameters (Parameters Tab) it Works.
Upvotes: 2