2011-10-13 433 views
9

我遇到了報告服務問題,在2005版本上運行本地rdlc文件。Report Viewer未加載,顯示空白 - 正在運行本地RDLC文件

我在HTML報表查看器設置爲本地運行,如下所示:

<rsweb:ReportViewer ID="ReportingServicesReportViewer" runat="server" Height="100%" 
      ProcessingMode="Local" ShowParameterPrompts="False" Width="100%"> 
     </rsweb:ReportViewer> 

在代碼

// create SqlConnection 
     SqlConnection myConnection = new SqlConnection(ConnectionString); 
     myCommand.Connection = myConnection; 
     SqlDataAdapter da = new SqlDataAdapter(myCommand); 

     //get the data 
     DataSet data = new DataSet(); 
     da.Fill(data); 

     if (data != null && data.Tables.Count > 0 && data.Tables[0].Rows.Count > 0) 
     { 
      ReportingServicesReportViewer.Visible = true; 
      ltrStatus.Text = string.Empty; 

      //provide local report information to viewer 
      ReportingServicesReportViewer.LocalReport.ReportPath = Server.MapPath(Report.RDLCPath); 

      //bind the report attributes and data to the reportviewer 
      ReportDataSource rds = new ReportDataSource("DataSet1", data.Tables[0]); 
      ReportingServicesReportViewer.LocalReport.DataSources.Clear(); 
      ReportingServicesReportViewer.LocalReport.DataSources.Add(rds); 
      ReportingServicesReportViewer.LocalReport.Refresh(); 
     } 
     else 
     { 
      ReportingServicesReportViewer.Visible = false; 
      ltrStatus.Text = "No data to display."; 
     } 

當方法來填充報告的結果的報告查看器被執行時,沒有任何東西出現,就好像報表查看器甚至不在那裏一樣。

我沒有麻煩拍攝什麼至今:

  • 進行錯誤檢查事件查看器,這是相關 我得到的,[域] \ sp_dbadmin原因只有一點: 無法打開明確指定的數據庫。 。但是,我正在連接的用戶是 系統管理員。我已經檢查了和 敢肯定,因爲我查了sys.server_role_members
  • 我試圖冒充登錄的用戶,都無濟於事
  • 我創建了系統管理員權限的特定用戶,並給所有訪問權限均來自IIS和也在sql server 2008.

有沒有人遇到類似這樣的問題,有什麼想法?

回答

7

嘗試使用簡單的報告,有時reportviewer會拋出由無效的RDLC導致的異常並顯示空的報告。

也嘗試調試項目,並期待在Visual Studio中的輸出窗口:你會看到警告提出BU的RDL引擎,它可能是調查錯誤的原因是有用的。

3

我有同樣的問題,在我的情況下,它原來,我已經提供了一個數據集,這不是實際的報告預計的對象類型。

在我的情況報告期望一個業務對象,但我提供了一個SQL數據源。

時,有上,不允許爲空或空白,但沒有提供的參數值的報表參數我也遇到同樣的問題。

另請注意,爲了在代碼中設置數據源,必須在onload事件中完成,而不是在page_load事件中完成。

+4

在我的情況下,我也有一個報告參數爲空的問題,然後加載一個空白報告。另外請記住,如果(!this.IsPostBack)只加載報告,否則它會進入永久加載循環。 – Ghlouw

8

我與VS2012有同樣的問題,報告顯示加載圖像,然後加載完成後,報告是空白的。數據存在但未呈現。

解決方案:只需將報告AsyncRendering更改爲False,報告再次正常工作。

5

當我在rdlc中添加參數但未分配參數時,我遇到了同樣的問題。 我通過添加此代碼解決。

Dim p_Date As Microsoft.Reporting.WebForms.ReportParameter 
p_Date = New Microsoft.Reporting.WebForms.ReportParameter("DATE", txtDate.Text) 
    Me.ReportViewer1.LocalReport.SetParameters(New Microsoft.Reporting.WebForms.ReportParameter() {p_Date}) 
    ReportViewer1.LocalReport.Refresh() 
+0

不是最好的代碼示例,但您確切地確定了問題! – Adam

1

在我的情況的罪魁禍首是其與允許空值= FALSE(未選中)。不要問我爲什麼參數。

+0

你是如何解決這個問題的?你是如何將它設置爲允許空值的? – CowboyBebop

0

有同樣的問題。花了一段時間找我,但事實證明我不小心new're reportViewer控制我自己,所以我失去了什麼Visual Studio設計器爲我創建時,我設計了窗體,這就是爲什麼報告查看器控件一直空白 - 我從來沒有在Visual Studio Designer的ReportViewer對象上設置任何屬性。

愚蠢的錯誤,但花了相當一段時間弄清楚。

2

這一次花了一些時間來弄清楚,所以希望這些檢查將節省您的時間:

1)驗證web.config中

<system.web> 
    <httpHandlers> 
    <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" /> 
    </httpHandlers> 

    <buildProviders> 
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
</buildProviders> 
</system.web> 

<system.webServer> 
    <handlers> 
    <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" /> 
    </handlers> 
<system.webServer> 

2)直接嘗試報表查看器控制移動任何配置成代碼之前設計視圖

Hard-Coded Report Viewer Control

3)驗證腳本管理器是頁面上的報告之前,觀衆

4)確保報表運行設計瀏覽器之外,在本地或在SSRS服務器

5)請務必將報告默認值所有參數上!需要參數且沒有默認值的報告顯示爲空白。

3

在我的情況下,ReportViewer控件不會提供錯誤消息(EventViewer或ReportViewer控件主體),只是空白頁面。我認爲這很難找到並解決問題。 Yoel Halb的回答是我的鑰匙!

稱爲IsReadyForRendering的屬性爲False。 In the BOL涉及參數主題。

我可以檢查整個參數的每個值與代碼(你可以從即時窗口中執行它)

var parameters = ReportViewer1.LocalReport.GetParameters() 

你會發現有問題的參數,當你的價值看屬性狀態「MissingValidValue」

希望這會有所幫助!