2015-10-15 75 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(); 
    }