I'm using the following code with which I'm trying to SetParametr :
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 is it wrong?
I've created a report parameter, the Parameters name is 'MyName'
UPDATE :
I'm using the following code :
//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 + @"ReportsReport1.rdlc";
_reportViewer.LocalReport.DataSources.Add(reportDataSource1);
//_reportViewer.ServerReport.SetParameters(report);
_reportViewer.RefreshReport();
data has displayed in the Report.
but , I'm using the following code :
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 + @"ReportsReport1.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
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…