查看SSRS时遇到问题。
当我调用reportViewer1.ServerReport.SetParameters(parm);
来查看C#win-form progarm中的报告时,会发生错误添加行GenerateReport()
。
错误:基础连接已关闭。接收时发生意外错误。
通过I.E地址栏上的// local_host / ReportServer查看报告时,这很好。
我在使用MS Server 2008,SQL Server 2008 感谢。
public void GenerateReport(DateTime fromdate, DateTime todate, float dauky, float psls, DateTime kybc)
{
ReportParameter[] parm = new ReportParameter[5];
parm[0] = new ReportParameter("fromdate", fromdate.ToShortDateString());
parm[1] = new ReportParameter("todate", todate.ToShortDateString());
parm[2] = new ReportParameter("kybc", kybc.ToString());
parm[3] = new ReportParameter("psls", psls.ToString());
parm[4] = new ReportParameter("dauky", dauky.ToString());
this.reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential("username", "pass", "domain");
reportViewer1.ShowCredentialPrompts = true;
reportViewer1.ServerReport.ReportServerUrl = new System.Uri("http://localhost:80/ReportServer");
reportViewer1.ServerReport.ReportPath = "/Report Project1/TEST";
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
reportViewer1.ServerReport.SetParameters(parm); //error occurs
reportViewer1.ServerReport.Refresh();
}