我正在开发SSRS报告。这是cs文件代码:SSRS报告停止工作
new protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
String reportTitle = GetValueFromQueryString("ReportTitle");
/* Get Agency name and set it in report parameters */
AgencyBO agencyBO = new AgencyBO();
Agency agency = new Agency();
agency = agencyBO.GetAgencyInformation();
List<ReportParameter> lstParam = new List<ReportParameter>();
lstParam.Add(new ReportParameter("Agency", agency.Name));
/* Declare parameters that are to be sent to Report Helper class */
string orderBy = string.Empty,
startAge = string.Empty,
endAge = string.Empty,
sex = string.Empty,
staffId = string.Empty,
statusId = string.Empty,
ethnicityId = string.Empty,
treatmentProviderId = string.Empty;
ConsumerSummaryReportCriteria consumerSummaryReportCriteria = new ConsumerSummaryReportCriteria();
Dictionary<String, String> lst = consumerSummaryReportCriteria.GetReportParams();
foreach (var pair in lst)
{
/* ---- Set parameters that are to be sent to Report Helper class ---- */
if (pair.Key == "orderBy" && pair.Value != string.Empty)
{
orderBy = pair.Value;
}
if (pair.Key == "startAge" && pair.Value != string.Empty)
{
startAge = pair.Value;
lstParam.Add(new ReportParameter("startAge", pair.Value));
}
if (pair.Key == "endAge" && pair.Value != string.Empty)
{
endAge = pair.Value;
lstParam.Add(new ReportParameter("endAge", pair.Value));
}
if (pair.Key == "gender" && pair.Value != string.Empty)
{
sex = pair.Value;
lstParam.Add(new ReportParameter("gender", pair.Value));
}
if (pair.Key == "staffIds" && pair.Value != string.Empty)
{
staffId = pair.Value;
}
if (pair.Key == "consumerStatusIds" && pair.Value != string.Empty)
{
statusId = pair.Value;
}
if (pair.Key == "ethnicityIds" && pair.Value != string.Empty)
{
ethnicityId = pair.Value;
}
if (pair.Key == "treatmentProviderIds" && pair.Value != string.Empty)
{
treatmentProviderId = pair.Value;
}
/* ---- Set parameters to report parameters list that are to be sent to
* RDLC to show report selection criteria at the end of the report ---- */
if (pair.Key == "staffNames")
{
lstParam.Add(new ReportParameter("staffNames", pair.Value));
}
if (pair.Key == "consumerStatusNames")
{
lstParam.Add(new ReportParameter("consumerStatusNames", pair.Value));
}
if (pair.Key == "treatmentProviderNames")
{
lstParam.Add(new ReportParameter("treatmentProviderNames", pair.Value));
}
if (pair.Key == "ethnicityNames")
{
lstParam.Add(new ReportParameter("ethnicityNames", pair.Value));
}
}
ReportHelper.ApplyReportSetting(ref rptConsumerSummaryReport, reportTitle, orderBy, startAge, endAge, sex, staffId, statusId, ethnicityId, treatmentProviderId);
rptConsumerSummaryReport.LocalReport.SetParameters(lstParam);
rptConsumerSummaryReport.LocalReport.Refresh();
}
}
它工作正常,但突然停止工作。 将打开一个空白aspx页面,并且报告查看器不会打开。
这里是aspx文件的代码。
<form id="frmConsumerSummaryReport" runat="server">
<div>
<asp:ScriptManager ID="scmReport" runat="server">
</asp:ScriptManager>
<rsweb:ReportViewer ID="rptConsumerSummaryReport" runat="server" Height="100%" AsyncRendering="False"
Width="100%" SizeToReportContent="True" Font-Names="Verdana"
Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
<LocalReport ReportPath="Reports\Consumer\ConsumerSummaryReport.rdlc">
</LocalReport>
</rsweb:ReportViewer>
</div>
</form>
所以你的代码是不是所有... – Episodex 2011-06-06 18:46:12
是啊代码是好的... :) – asma 2011-06-07 04:33:46
啊,我误解了你。您将参数添加到.rdl。如果您在开始时了解这一点,将有所帮助:D。 – Episodex 2011-06-08 10:19:05