February 4, 2013 at 4:24 am
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?
March 13, 2014 at 1:32 pm
Hi Frank,
I'm getting the same problem. Did you solve it?
March 13, 2014 at 4:42 pm
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 NameParameter 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.
March 15, 2014 at 11:17 am
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
March 16, 2014 at 12:08 pm
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.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply