2011-08-19 35 views
0

嗨我正在嘗試在我的網站頁面上加載mg報告時出現不同的錯誤..我正在使用報告查看器,並且使用linq傳遞參數..附加代碼和錯誤。報告服務的內部連接錯誤

報告處理過程中發生錯誤。 內部連接致命錯誤。

報告處理過程中發生錯誤。 無法讀取數據集SummaryReport的下一個數據行。 內部連接致命錯誤。

ReportGenerationBL report_worker = new ReportGenerationBL(); 
     IEnumerable<ART.Library.Data.SummaryReport> items=report_worker.getSummaryReport(); 

     rpt_view.Reset(); 


     ReportDataSource[] reportds = new ReportDataSource[2]; 
     reportds[0] = new ReportDataSource("RenewableObj", report_worker.getRenewablePackage()); 
     reportds[1] = new ReportDataSource("SummaryReport", items.Where(a=>a.Title!="No Status")); 

     List<ReportParameter> paramList = new List<ReportParameter>(); 

     paramList.Add(new ReportParameter("p_OldPlanAwaiting", items.Where(a => a.Title == "No Status" && a.Category == 0).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_OldPlanRenewable", items.Where(a => a.Title != "No Status" && a.Category == 0).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_OldPlanRenewed", items.Where(a => a.Title != "No Status" && a.Category == 0 && a.Renewed == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_OldPlanRenewedMSF2", items.Where(a => a.Title != "No Status" && a.Category == 0 && a.Renewed == 1).Sum(a => a.MSFOldPlans).ToString())); 

     paramList.Add(new ReportParameter("p_VoiceAwaiting", items.Where(a => a.Title == "No Status" && a.Category == 3).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_VoiceRenewable", items.Where(a => a.Title != "No Status" && a.Category == 3).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_VoiceRenewed", items.Where(a => a.Title != "No Status" && a.Category == 3 && a.Renewed == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_VoiceRenewedMSF", items.Where(a => a.Title != "No Status" && a.Category == 3 && a.Renewed == 1).Sum(a => a.MSFVoiceOnly).ToString())); 

     paramList.Add(new ReportParameter("p_NoVoiceAwaiting", items.Where(a => a.Title == "No Status" && a.Category == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_NoVoiceRenewable", items.Where(a => a.Title != "No Status" && a.Category == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_NoVoiceRenewed", items.Where(a => a.Title != "No Status" && a.Category == 1 && a.Renewed == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_NoVoiceRenewedMSF", items.Where(a => a.Title != "No Status" && a.Category == 1 && a.Renewed == 1).Sum(a => a.MSFNoVoice).ToString())); 

     paramList.Add(new ReportParameter("p_WithOthersAwaiting", items.Where(a => a.Title == "No Status" && a.Category == 2).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_WithOthersRenewable", items.Where(a => a.Title != "No Status" && a.Category == 2).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_WithOthersRenewed", items.Where(a => a.Title != "No Status" && a.Category == 2 && a.Renewed == 1).Sum(a => a.Counter).ToString())); 
     paramList.Add(new ReportParameter("p_WithOthersRenewedMSF", items.Where(a => a.Title != "No Status" && a.Category == 2 && a.Renewed == 1).Sum(a => a.MSFWithVoice).ToString())); 


     rpt_view.LocalReport.DataSources.Add(reportds[0]); 
     rpt_view.LocalReport.DataSources.Add(reportds[1]); 
     rpt_view.LocalReport.ReportPath = "PrintFile/SummaryReport.rdlc"; 
     rpt_view.LocalReport.SetParameters(paramList); 
     rpt_view.DataBind(); 

請幫助我..適用於DB SQL函數調用getsummary

代碼。

public IEnumerable<SummaryReport> getSummaryReport() 
    { 
     IEnumerable<SummaryReport> items = from a in ARTDB.func_SummaryReport() 
              select new SummaryReport { Counter = TryParse.TryParseInt(a.counter), Status = a.status, Title = a.title, SortNo = TryParse.TryParseInt(a.sortno), Category = TryParse.TryParseInt(a.category), Renewed = a.renewed ,MSFNoVoice = a.msfnovoice,MSFOldPlans = a.msfoldplans, MSFVoiceOnly = a.msfvoiceonly, MSFWithVoice = a.msfwithvoice}; 
     return items; 
    } 

它調用已存儲在數據庫中的函數..這裏是設計器中的代碼。

public IQueryable<func_SummaryReportResult> func_SummaryReport() 
    { 
     return this.CreateMethodCallQuery<func_SummaryReportResult>(this, ((MethodInfo)(MethodInfo.GetCurrentMethod()))); 
    } 
+0

你可以張貼代碼getSummaryReport()? – saus

+0

完成添加..代碼 – anonymous1110

+0

和ARTDB.func_SummaryReport()?再次添加 – saus

回答

0

我以前沒有使用過DataContext.CreateMethodCallQuery,但我猜測它使用延遲執行。請返回在getSummaryReport()items.ToList()

public IEnumerable<SummaryReport> getSummaryReport() 
    { 
     IEnumerable<SummaryReport> items = from a in ARTDB.func_SummaryReport() 
              select new SummaryReport { Counter = TryParse.TryParseInt(a.counter), Status = a.status, Title = a.title, SortNo = TryParse.TryParseInt(a.sortno), Category = TryParse.TryParseInt(a.category), Renewed = a.renewed ,MSFNoVoice = a.msfnovoice,MSFOldPlans = a.msfoldplans, MSFVoiceOnly = a.msfvoiceonly, MSFWithVoice = a.msfwithvoice}; 
     return items.ToList(); // <-- here 
    } 
+0

人工作!你的男人 – anonymous1110