views:

811

answers:

2

Report viewer from SQL reporting services in VS 2008 report control If I create a new report in VS 2008 they have a .rdlc extension and work correctly.

I have some reports that I was using in SQL reporting services. Extensions are .rdl and want to get them to work with VS 2008.

I copied the rdl files and the .rdl.data files over to VS 2008 (SP1) project but when I go to select the report in the control it does not see the file (I assume it is looking for a .rdlc file)

I tried rename the file to .rdlc and loaded the file up and got

The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded.

I see this http://social.msdn.microsoft.com/Forums/en-SG/vsreportcontrols/thread/65cefd7d-00d8-4be6-a53a-7e34dfd7eb2b

I see here http://www.gotreportviewer.com/ It says "RDL files are fully compatible with the ReportViewer control runtime. However, RDL files do not contain some information that the design-time of the ReportViewer control depends on for automatically generating data-binding code. By manually binding data, RDL files can be used in the ReportViewer control."

But the link for how to manual bind the data is broken.

Any ideas on how to manually rebind the data? Or a better way to get these reports to work with the 2008 control?

+1  A: 

The server version *.rdl in SSRS 2008 is unfortunately not compatible with its local counterpart, the *.rdlc files.

Basically, all you can do is

  • either use the .RDL directly on the server (using "remote rendering" report in your ReportViewer control)

  • basically re-create the whole report as a local report from scratch

It's unbelievable - but unfortunately, it's the truth..... let's hope with .NET 4, Visual Studio 2010 it'll be better.

marc_s
So in 2010, the report control may use .rdl or .rdlc?I guess I need to get the beta and gives this a try.
Maestro1024
I don't know - but you can always hope for the best! :-)
marc_s
+1  A: 

If you don't need advanced features like drill-down, and can't use VS2010, you can do this hack (that I do):

  • install new reportviewer.exe from VS2010 (beta2 or later I guess);
  • add Common/WebForms assemblies of the ReportViewer of version 10.0 to references;
  • manually parse RDL XML structure to get data source and/or query SQL (very easy);
  • use that to populate LocalReport.DataSource;
  • Do LocalReport.Render("PDF") to get PDF output (ActionResult code for generating PDF response is easy to find);
  • put a "View" button on the page and iframe;
  • "View" button (via JavaScript) will assign iframe src attribute to the url that returns the above PDF content - and it will give a nice PDF preview of the report inside the iframe;
  • alternatively, one can use jQuery Media plugin to render PDF object tag with same results;
  • additionally I parse RDL XML parameters and show them on page and pass them to the "generate report" url - I get my own nice UI controls for parameters as benefit;
  • additionally I have my own "export" buttons that calls LocalReport.Render(format) and provide output with correct MIME type (that's Excel, Word, PDF, and my manual CSV) - the export is improved in new version of the report viewer.

The above list may look scary but it took me only 2 days to hack the complete solution in ASP.NET MVC, and it's only ~300 lines of code, including my own CSV generation.

The code to bind data is very simple once you get DataTable/DataSet (from XML queries):

        var reportDataSource = new ReportDataSource();
        reportDataSource.Name = name;
        reportDataSource.Value = ds.Tables[0];
        localreport.DataSources.Add(reportDataSource);
queen3
Wow, looks like you have been down the dark path that is MS reporting services. I ended up just redoing the reports in VS 2008 but I am very interested in trying what you are talking about here.
Maestro1024
Yes, I blogged a bit about how SSRS and other reporting engines suck. But then I decided to use it anyway - because I like the designer, and a reasonable part of the rendering engine (LocalReport) is free. Also, Report Viewer is useless in MVC anyway, and HTML it produces is awful. PDF is much nicer to preview. Of course, it means full report generation (no paging), etc, but there're always tradeoffs; it's still a nice solution in many cases. Nobody denies buying full reporting services and waiting for VS2010 (RC is out now); but it's good to have free alternatives.
queen3