2012-01-04 54 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