2012-01-04 93 views
1

我想將報告服務文件從VS2008轉換到VS2010。它在不使用ReportViewer的情況下被填充和保存。升級從VS2008到VS2010的報告服務報告

以下步驟會導致錯誤。

  1. 在VS2010中打開項目。一切正常。
  2. 打開.rdlc文件。它升級。
  3. 再次運行應用程序。它失敗。

我從http://www.gotreportviewer.com/objectdatasources/index.html下載了樣本,並使用http://knol.google.com/k/microsoft-sql-server-reporting-services-ssrs#Data_Sources的方法保存信息。

有什麼辦法可以解決這個錯誤嗎?我需要能夠使用VS2010來更新報告。

[錯誤]

{「報表定義是無效的詳細情況:報表定義具有無效的目標命名空間「http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition 「不能升級。」}

[代碼]

//Test Code 
try 
{ 
    ReportViewer viewer = new ReportViewer(); 
    viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing); 
    viewer.ProcessingMode = ProcessingMode.Local; 

    //Either get this via the embedded resource, or directly via the path. -> better to use embedded resource! 
    viewer.LocalReport.ReportEmbeddedResource = "AuthorBooks.AuthorBooks.rdlc";  //Namespace.ReportName.rdlc   
    //viewer.LocalReport.ReportPath = @"C:\Test Projects\ReportingServicesWorking\AuthorBooks.rdlc"; 

      viewer.LocalReport.DataSources.Add(
       new ReportDataSource 
       (
       "AuthorBooks_Author", 
       m_authors 
       ) 
       ); 

      string mime, encoding, extension; 
      string[] streams; 
      Warning[] warnings; 

      byte[] report = viewer.LocalReport.Render("PDF", null, 
       out mime, 
       out encoding, 
       out extension, 
       out streams, 
       out warnings); 

      string outputPath = @"C:\Test Projects\ReportingServicesWorking\TestSave.pdf"; 
      File.WriteAllBytes(outputPath, report); 
      Process.Start(outputPath); 
     } 
     catch (Exception ex) 
     { 
      //Do stuff here. 
     } 

回答

1

確保ReportViewer 2010 redistributable被安裝,並且該版本的ReportViewer控件的應用程序中使用。

+0

謝謝。我會給它一個去,讓我知道如果我能得到它的工作。 – HockeyJ 2012-01-04 15:11:06