I've created an rdlc report. I have a reportViewer on my form.
When I try to load the report I get : "The report definition for report 'xxxx.rdlc' has not been specified". I can't figure this out.
I have a datatable with the data I need for the report.
I take this dataTable and I load it back to my database, to a table called "FinalReport". (The reason i'm doing this, is because that rdlc requires some sort of a dataSource.)
I have a table inside my report (table1).
This is my code (inside my form, where the report viewer is located):
this.finalDataReportTableAdapter.Fill(this.nehasitDataSet.FinalDataReport);
localReport.ReportEmbeddedResource = @"Resources\VisibleAssets.rdlc";
//I'm not so sure about the following line, but it's the only line that prevented me from getting an error ("no reportdefinition defined"
using (StreamReader rdlcSR = new StreamReader(@"Resources\VisibleAssets.rdlc"))
{
localReport.LoadReportDefinition(rdlcSR);
localReport.Refresh();
}
this.reportViewer.RefreshReport();
I also connected the report to the dataTable and the reportViewer to the report.
I really can't see the problem, and I searched Google for it.
Any help will be highly appreciated.
Best Answer
There are some reasons causing this problem and sometimes the problem might occur only when publishing the same application to
IIS
. If the report file (*.rdlc) is existed in the related location and the problem still continues, you can try the following methods in order to fix it:Change:
to:
And then change
Build Action
property toEmbedded Resource
from the properties ofYourReportName.rdlc
file. Hope this helps...