【问题标题】:An error has occurred during report (rdlc) processing报告 (rdlc) 处理期间发生错误
【发布时间】:2015-10-29 21:03:10
【问题描述】:

我在创建 RDLC 报告时遇到错误。 错误在于

" 报告处理过程中发生错误。 无法创建到数据源“ds_SalesQuotation”的连接。 关闭数据读取器时调用“读取”不是有效操作。 阅读器关闭时调用 Read 的尝试无效。 "

我创建了 ds_SalesQuotation.xsd 文件。 在 rdlc 报告中,将数据集名称设为“dsSalesQuotation”并将数据源设置为“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();
}
   }
    }

我的代码是否有任何错误。请任何人检查..

【问题讨论】:

标签: report rdlc dynamic-rdlc-generation


【解决方案1】:

我得到了我的错误。我重写了上面的代码,如下所示。

现在可以了

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-11
    • 2021-06-21
    相关资源
    最近更新 更多