Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Issue while Integrating Microsoft.Reporting.WebForms class with SSRS reports System.InvalidCastException

$
0
0

We are using Microsoft.Reporting.WebForms reportparameter[] class to send parameters to report viewer as in the code below .Here the RDL files is expecting datatype as Boolean\Date etc.

Since the ReportParameter.ReportParameter accepts only string values  while rendering I am getting System.InvalidCastException.What is the workaround for this issue



<div class="WordSection1">

 

ReportParameter[] repParams = new ReportParameter[2];
                    if (Session["rptCurrentPage"].ToString() == "1")
                    {
                        repParams[0] = new ReportParameter("param_ParentRecordKey", Session["ID"].ToString());
                        repParams[1] = new ReportParameter("param_UserID", SessionHelper.UserProfile.ApplicationUserId.ToString());
                    }
                    else
                    {
                        repParams[0] = new ReportParameter("param_SubsidiaryAccountRecordSystemKey", Session["ID"].ToString());
                        repParams[1] = new ReportParameter("param_UserID", SessionHelper.UserProfile.ApplicationUserId.ToString());
                    }
                    ReportViewer1.ServerReport.SetParameters(repParams);
                    ReportViewer1.ServerReport.Refresh();

</div>

 


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>