Monday, February 20, 2012

Report re-opening problem

Hi,

I have created a RDL report and successfully deployed it in reporting server. The following code is used to open the Report.

private void Form1_Load(object sender, EventArgs e){

this.reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;

this.reportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/ReportServer");

this.reportViewer1.ServerReport.ReportPath = "/Import Run Reports/ImportRunReport";

Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[2];param[0] = new Microsoft.Reporting.WinForms.ReportParameter("RunId", "195900,195904,195711,195707");param[1] = new Microsoft.Reporting.WinForms.ReportParameter("ReportType", "Summary");

reportViewer1.ServerReport.SetParameters(param);

reportViewer1.RefreshReport();

}

Very first time the Report is opening successfully. Once I close the window and again i am trying to open the report i am getting the following error "The underlying connection was closed: A connection that was expected to be kept alive was closed by the server."

Could you Please help me in this regard.

Dear Ravi,

I had the same issue as you once. I am going to past some code on here that I use for my report viewer.

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using Microsoft.Reporting.WinForms;

namespace Detail_Report_Viewer

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Load(object sender, EventArgs e)

{

this.reportViewer1.RefreshReport();

}

private void runReport_Click(object sender, EventArgs e)

{

reportURL.Text = "/Import Run Reports/ImportRunReport";

reportViewer1.ProcessingMode =

Microsoft.Reporting.WinForms.ProcessingMode.Remote;

reportViewer1.ServerReport.ReportServerUrl =

new Uri (@."http://localhost/ReportServer");

reportViewer1.ServerReport.ReportPath = reportURL.Text;

Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[2];param[0] = new Microsoft.Reporting.WinForms.ReportParameter("RunId", "195900,195904,195711,195707");param[1] = new

Microsoft.Reporting.WinForms.ReportParameter("ReportType", "Summary");

reportViewer1.ServerReport.SetParameters(param);

reportViewer1.RefreshReport();

}

}

}

I was using a textbox to display the url, but you can remove that if you feel it to be necessary. I updated it with your settings.

No comments:

Post a Comment