1

I got the error While I am creating RDLC report. Error is that

" An error has occurred during report processing. Cannot create a connection to data source 'ds_SalesQuotation'. Calling 'Read' when the data reader is closed is not a valid operation. Invalid attempt to call Read when reader is closed. "

I create ds_SalesQuotation.xsd file. In rdlc report give dataset name as 'dsSalesQuotation' and set datasourse as 'ds_SalesQuotation'

my code is on reportviewr(.aspx)

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
        using (BillingAppEntities context = new BillingAppEntities())
        {
            var val = context.Sp_SalesQuotation(id);
            ReportDataSource rd = new ReportDataSource("dsSalesQuotation", val);
            ReportViewer1.LocalReport.DataSources.Add(rd);
            ReportViewer1.LocalReport.Refresh();
}
   }
    }

Is there any mistaken in my code.please check it anybody..

Safeena
  • 395
  • 2
  • 7
  • 21
  • Could you please have a look at my answer on [An error occurred during report processing. RLDC reporting in ASP.NET MVC](http://stackoverflow.com/questions/28966954/an-error-occurred-during-report-processing-rldc-reporting-in-asp-net-mvc)? – Murat Yıldız Apr 24 '16 at 20:19

1 Answers1

0

I got my error.I re-write the above code,that is given below.

Now it is working

 private void PopulateReport(int id)
    {
        List<Sp_SalesQuotation_Result> ls = new List<Sp_SalesQuotation_Result>();
        using (BillingAppEntities context = new BillingAppEntities())
        {
            ls = context.Sp_SalesQuotation(id).ToList();              
        }
        ReportDataSource rd = new ReportDataSource("dsSalesQuotation", ls);
        ReportViewer1.LocalReport.DataSources.Clear();
        ReportViewer1.LocalReport.DataSources.Add(rd);
        ReportViewer1.LocalReport.Refresh();
    }
Safeena
  • 395
  • 2
  • 7
  • 21