Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Data retrieval failed for the subreport Expand / Collapse
Author
Message
Posted Monday, February 4, 2013 4:24 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 11:46 AM
Points: 73, Visits: 137
I am having trouble with an RDLC report with a sub-report.

It is the typical Invoice/Invoice Detail situation. My main report shows the invoice data and the subreport shows the details or line items for that invoice.

I load the report up with this code:

InvoiceDataSet dataset = new InvoiceDataSet();
dataset.BeginInit();
reportDataSource1.Name = "DataSet1";

//Name of the report dataset in our .RDLC file
reportDataSource1.Value = dataset.InvoicesSelectByManifestNumberForReport;
this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
this._reportViewer.LocalReport.ReportPath = "../../Reports/Invoice.rdlc";
dataset.EndInit();

//fill data into WpfApplication4DataSet
InvoiceDataSetTableAdapters.InvoicesSelectByManifestNumberForReportTableAdapter invoiceTableAdapter = new InvoiceDataSetTableAdapters.InvoicesSelectByManifestNumberForReportTableAdapter();

invoiceTableAdapter.ClearBeforeFill = true;
invoiceTableAdapter.Fill(dataset.InvoicesSelectByManifestNumberForReport, this.manifestNumber);

_reportViewer.RefreshReport();


The sub report runs off another dataset which is based on a stored procedure that accepts a parameter (the invoice primary key) and looks like it's hooked up properly. However I get this error:

Data retrieval failed for the subreport 'InvoiceDetail'

Any ideas what I could be missing or how to debug this?
Post #1415223
Posted Thursday, March 13, 2014 1:32 PM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 9:30 AM
Points: 67, Visits: 342
Hi Frank,
I'm getting the same problem. Did you solve it?
Post #1550904
Posted Thursday, March 13, 2014 4:42 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 5:02 PM
Points: 179, Visits: 7,344
Is it perhaps not passing the Invoice PK to the subreport? In the main report, right click on the cell/textbox that contains the subreport and go to Properties. In Parameters, there should be something like

Parameter Name	Parameter Value
@invoicePK =Fields!InvoicePK.Value


This passes the invoice parameter from whatever field it occupies on the main report to the subreport. From the verbiage of the error I'm not sure this is the problem, but at least it's one thing to check.
Post #1550961
Posted Saturday, March 15, 2014 11:17 AM


Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, June 25, 2014 9:30 AM
Points: 67, Visits: 342
I solved it. The problem was that my sub report had parameters that had available values. sub reports can't have available values in their parameters
Post #1551504
Posted Sunday, March 16, 2014 12:08 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Today @ 11:46 AM
Points: 73, Visits: 137
Sorry for the slow response. Yes I did solve it, it's been so long I can't remember the exact problem and solution, but I can give you, or anyone who wants, a working example (or steps to get it to work). Glad you found your problem and got it working.
Post #1551583
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse