Click here to Skip to main content
15,799,017 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I'm using the following code trying to SetParametr :
C#
var report = new ReportParameter[1];
   report[0] = new ReportParameter("MyName", "Raha");
   var reportDataSource1 = new ReportDataSource { Name = "WpfApplication17_User", Value = _users };
   _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
   _reportViewer.ServerReport.SetParameters(report);
   _reportViewer.LocalReport.ReportPath = "../../Report1.rdlc";
   _reportViewer.RefreshReport();

error : The source of the report definition has not been specified

Why wrong?

I've created a report parameter , Parameter name is 'MyName'

I'm using the following code :
C#
//var report = new ReportParameter[1];
   //report[0] = new ReportParameter("MyName", "Raha");
   var reportDataSource1 = new ReportDataSource { Name = "WpfApplication17_User", Value = _users };
   string exeFolder = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
   _reportViewer.LocalReport.ReportPath =exeFolder + @"\Reports\Report1.rdlc";
   _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
   //_reportViewer.ServerReport.SetParameters(report);
   _reportViewer.RefreshReport();

data displayed in Report.

but , I'm using the following code :
C#
var report = new ReportParameter[1];
           report[0] = new ReportParameter("MyName", "Raha");
           var reportDataSource1 = new ReportDataSource { Name = "WpfApplication17_User", Value = _users };
           string exeFolder = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
           _reportViewer.LocalReport.ReportPath = exeFolder + @"\Reports\Report1.rdlc";
           _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
           _reportViewer.ServerReport.SetParameters(report);//error
           _reportViewer.RefreshReport();

error as : The source of the report definition has not been specified
Posted
Updated 26-Mar-23 11:16am
v4
Comments
Pawan Sharma Software Engineer 7-Dec-12 6:07am    
My SQL Report is display properly, but when i download from export link then i get same error, but when i set postbacktrigger controlid =ReportviewerId and refresh manual and after click on export for download then i can download the report
how can i download report properly

Hi. I had the same error and the problem was with NULL values from SQL.
Check if you have null values in your SQL result. I  lost two days searching for what is not ok with "The report definition for report '' has not been specified".
 
Share this answer
 
On line
C#
_reportViewer.ServerReport.SetParameters(report);//error 
use LocalReport instead of ServerReport
 
Share this answer
 
v3
Dears

i use Vb.net 2012

my project in web form i have report view problem for below error

An error occurred during local report processing.
The report definition for report 'Report1' has not been specified
Object reference not set to an instance of an object.


please i need help
 
Share this answer
 
Comments
pasha80 6-Aug-14 11:41am    
Hi,
I had the same problem and I burned one day for this bug/
My solution was just change the height and width of body report, enlarge a little one... :)
It can to resolve this prome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900