SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Data retrieval failed for the subreport


Data retrieval failed for the subreport

Author
Message
Frank Cazabon
Frank Cazabon
SSC Veteran
SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)

Group: General Forum Members
Points: 236 Visits: 178
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?
Raul Undreiner
Raul Undreiner
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 382
Hi Frank,
I'm getting the same problem. Did you solve it?
doug.brown
doug.brown
SSChasing Mays
SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)SSChasing Mays (640 reputation)

Group: General Forum Members
Points: 640 Visits: 13957
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.
Raul Undreiner
Raul Undreiner
SSC-Enthusiastic
SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)SSC-Enthusiastic (136 reputation)

Group: General Forum Members
Points: 136 Visits: 382
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
Frank Cazabon
Frank Cazabon
SSC Veteran
SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)SSC Veteran (236 reputation)

Group: General Forum Members
Points: 236 Visits: 178
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search