我正在尝试将报告服务文件从VS2008转换为VS2010。在不使用ReportViewer的情况下填充和保存它。
以下步骤会导致错误。
我从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.
}