2015-10-15 74 views
1

我在创建RDLC报告时遇到了错误。 错误是报告(rdlc)处理期间发生错误

“报表处理期间发生错误。 无法创建调用‘读取’时,数据读取器是关闭的是不是一个有效的操作,数据源‘ds_SalesQuotation’。 的连接。 无效试图在读取器关闭时调用Read。“

我创建了ds_SalesQuotation.xsd文件。 在RDLC报告中给出的数据集名称为“dsSalesQuotation”,并设置datasourse为“ds_SalesQuotation”

我的代码是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(); 
} 
    } 
    } 

有没有在我的code.please任何错误的检查,任何人..

+0

能否请你看看我的答案[报告处理过程中出现错误。在ASP.NET MVC中的RLDC报告](http://stackoverflow.com/questions/28966954/an-error-occurred-during-report-processing-rldc-reporting-in-asp-net-mvc)? –

回答

0

我得到了我的错误。我重新写了上面的代码,这是下面给出的。

现在正在

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(); 
    }