1

我使用Visual Studio 2010和C#構建查詢兩個數據庫的應用程序,然後生成也包含子報表的報表。主報告將三個參數傳遞給子報表。主報告的每個記錄都有空白報告。因此,我將NoRowsMessage設置爲「Nothing Returned」以確保子報表確實正在顯示。現在,而不是空白子報表返回我的消息。我已經通過預覽數據和輸入參數值來測試tableadapter。結果顯示很好。我的猜測是,由於某些原因,參數沒有正確傳遞給子報表。我試圖設置參數,以允許空值,也允許空白值。沒有什麼變化。我已經將LocalReport.SubreportProcessing設置爲一個新的SubreportProcessingEventHandler。我在該子報表的事件處理程序中設置數據源。我不知道我錯過了什麼。任何建議都會有幫助。子報表返回零結果

這裏是從主模

私人無效JointAgreement_Load(對象發件人,EventArgs的) { // TODO的代碼:這行代碼加載數據的進入「termLookup.ACADEMICCALENDAR」表。您可以根據需要移動或移除它。 this.aCADEMICCALENDARTableAdapter1.Fill(this.termLookup.ACADEMICCALENDAR); // TODO:這行代碼將數據加載到'yearLookup.ACADEMICCALENDAR'表中。您可以根據需要移動或移除它。 this.aCADEMICCALENDARTableAdapter.Fill(this.yearLookup.ACADEMICCALENDAR); }

private void button1_Click(object sender, EventArgs e) 
    { 
     string year = comboBox1.Text; 
     string term = comboBox2.Text; 
     Classes.Functions.GetStudentList(year, term); 
     List<ReportParameter> paramList = new List<ReportParameter>(); 
     paramList.Add(new ReportParameter("Year", year, false)); 
     paramList.Add(new ReportParameter("Term", term, false)); 
     reportViewer1.LocalReport.SetParameters(paramList); 
     reportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SetSubDataSource); 
     this.joint_Agreement_InfoTableAdapter.Fill(this.jointAgreementInfo.Joint_Agreement_Info); 
     this.reportViewer1.RefreshReport(); 
    } 

    public void SetSubDataSource(object sender, SubreportProcessingEventArgs e) 
    { 

     e.DataSources.Add(new ReportDataSource("StudentDetail", tRANSCRIPTDETAILBindingSource)); 

    } 
+0

你能提供一些代碼嗎? – oGJo

+0

我添加了一些代碼。 – mister

+0

Functions類中有很多代碼。我從一個數據庫中獲取信息並對其進行處理,並將結果放入數據庫的另一個表中。該報告基於新表和另一個數據庫中的另一個表。 – mister

回答