How to add parameters to SSRS reports
a problem occurred after the connection is to add parameters to the report after the report is constantly refreshed, with the last report refresh is the same problem. So let's take a look at the next.
1.
This is a constant refresh refresh after adding default parameters to the report and entering the page.
ReportParameter para =NewReportParameter ("ReportParameter1","1");//Parameter ReportViewer1.ServerReport.ReportServerCredentials=Newmyreportservercredentials (); REPORTVIEWER1.SERVERREPORT.REPORTSERVERURL=NewUri ("HTTP//Report server address/ReportServer"); ReportViewer1.ServerReport.ReportPath="/Report Name"; ReportViewer1.ServerReport.SetParameters (NewReportparameter[] {para}); Incoming parameters
Add this code to the Page_Load after the situation has occurred. Always displays in load. It seems to be refreshing.
Solve
if (! IsPostBack) {
ReportParameter para = new ReportParameter ("ReportParameter1", "1");//Parameters ReportViewer1.ServerReport.ReportServerCredentials = new myreportservercredentials (); REPORTVIEWER1.SERVERREPORT.REPORTSERVERURL = new Uri ("http://Report Server address/ReportServer"); ReportViewer1.ServerReport.ReportPath = "/Report name"; ReportViewer1.ServerReport.SetParameters (new reportparameter[] {para}); Incoming parameters
}
When you open the page again, the default load report appears.
It worked. I'm going to pay attention to the report.
How to add parameters to SSRS reports