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 specifie
Exactly like what you said because that rdlc requires some sort of a dataSource :) It is a tricky issue in Report viewer and to solve it I wrote a method that will bind the report direct from Datatable:
private void GenerateReportDirect(ReportViewer reportViewer, string datasource, DataTable dt, string reportpath)
{
reportViewer.LocalReport.ReportPath = reportpath;
ReportDataSource repds = new ReportDataSource(datasource, dt);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(repds);
reportViewer.LocalReport.Refresh();
}
and to implement this method you have to specify putting the string of dataset table adapter just a name but our report will take the data to bind from the data table (we will cheat on our report viewer :) )
private void BindReport(DataTable dt)
{
string reportPath = Server.MapPath("StudentBus.rdlc");
GenerateReportDirect(ReportViewer1, "StudentDataSet_usp_RPT_StudentBus", dt, reportPath);
}
I hope this will help :) .