How to Pass parameters value in SSRS rdl through .NET

Posted by Robin_Ahuja2008 under ASP.NET on 10/8/2012 | Points: 10 | Views : 12501 | Status : [Member] | Replies : 1
Hello experts,
I m calling one SSRS report which is on another server Url (http://10.32.149.149/reportserver) in my .NET application
It works fine when i call from Reportviewer.aspx directly without passing any parameters

But when i call this report by passing parameters from .NET, it gives error

ReportViewer1.ProcessingMode = ProcessingMode.Remote;
IReportServerCredentials irsc = new CustomReportCredentials("manoj", "password", "domain");
ReportViewer1.ServerReport.ReportServerCredentials = irsc;




ReportViewer1.ServerReport.ReportPath = "/ReportRDL/RptStateInfo";
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://10.32.149.149/reportserver");

ReportViewer1.ShowParameterPrompts = false;
ReportParameter[] parm = new ReportParameter[7];
parm[0] = new ReportParameter("P_STATEID_V", "12");
parm[1] = new ReportParameter("P_DISTRICTID_V", "245");
parm[2] = new ReportParameter("P_SUBDISTRICTID_V", string.Empty);
parm[3] = new ReportParameter("P_HEALTHFACILITYID", string.Empty);
parm[4] = new ReportParameter("P_FORMID_N", "34");
parm[5] = new ReportParameter("P_FINYEARID_N", "16");
parm[6] = new ReportParameter("P_EntryLEvel", "D");

this.ReportViewer1.LocalReport.SetParameters(parm);
ReportViewer1.ServerReport.Refresh();


And error is The source of the report definition has not been specified

Please suggest any solution for it

Regards,
Robin Ahuja



Responses

Posted by: Robin_Ahuja2008 on: 10/9/2012 [Member] Starter | Points: 25

Up
0
Down
Hey I just find the solution, it was a silly mistake

replace the code
this.ReportViewer1.LocalReport.SetParameters(parm);


with this


this.ReportViewer1.ServerReport.SetParameters(parm);


Regards,
Robin Ahuja

Robin_Ahuja2008, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response